---
title: "R Examples"
author: "Keith VanderLinden"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## Basic Types

**Integers**
```{r} 
i <- 1 + 1
i
```

**Doubles**
```{r}
3.14
pi
```

**Character Strings**
```{r}
s <- "Hello, world!"
s
```

**Logical**
```{r}
b <- TRUE
b
```

## Additional Types

**Vectors**
```{r}
v <- c("one", "two")
v
```

**Dates** (Using `lubridate`)
```{r warning = FALSE, message = FALSE}
library(lubridate)

birthdate <- ymd(20000207)
year(birthdate)
wday(birthdate, label = TRUE)
```

**Factors**
```{r}
data <- c("East", "West", "East", "North", "North", "East", "West", "South", "West", "East", "North")
data_factor <- factor(data)
typeof(data_factor)
```

**Dataframes** &amp; **Tibbles**
```{r warning = FALSE, message = FALSE}
library(gapminder)

gapminder
typeof(gapminder$continent)
class(gapminder$continent)
```
