c()
c(6, 4, 5, 2, 3)
## [1] 6 4 5 2 3
Note that quotes shouldn’t be used with numbers, but should be used with character strings.
c("apple", "banana", "economics")
## [1] "apple" "banana" "economics"
c(6, 3, 2) + c(3, 2, 1) == c(9, 5, 3)
## [1] TRUE TRUE TRUE
min(c(6, 3, 2)) == 2
## [1] TRUE
sum(c(6, 3, 2)) == 11
## [1] TRUE
100 * c(6, 3, 2) == c(600, 300, 200)
## [1] TRUE TRUE TRUE
c(6, 3, 2) / c(2, 3, 1) == c(12, 9, 2)
## [1] FALSE FALSE TRUE
length(c(1:5)) == 5
## [1] TRUE
sample(c("heads","tails"), size = 5, replace = TRUE)
## [1] "tails" "tails" "tails" "heads" "tails"
us_data <- tibble(
year = c(1957, 1977, 1997, 2017),
gdpPercap = c(14847, 24073, 35767, 60062),
lifeExp = c(69.5, 73.4, 76.8, 78.5)
)
us_data %>% print()
## # A tibble: 4 × 3
## year gdpPercap lifeExp
## <dbl> <dbl> <dbl>
## 1 1957 14847 69.5
## 2 1977 24073 73.4
## 3 1997 35767 76.8
## 4 2017 60062 78.5