67^3 - 112^2
## [1] 288219
log(125)
## [1] 4.828314
log(81, 3)
## [1] 4
flights_d <- c(140, 150, 100, 90, 230, 240, 165)
flights_a <- c(65, 145, 80, 87, 220, 268, 216)
flights_d[3]
## [1] 100
(flights_d - flights_a)[2]
## [1] 5
(flights_a - flights_d)[7]
## [1] 51
sum(flights_d)
## [1] 1115
cats <- c(4.765, 3.230, 1.256, 1.780, 2.583, 2.781, 3.945, 2.345)
length(cats)
## [1] 8
sort(cats)[1]
## [1] 1.256
sort(cats, decreasing = TRUE)[1]
## [1] 4.765
sort(cats)[length(cats)]
## [1] 4.765
cats.round <- floor(cats)
cats.round
## [1] 4 3 1 1 2 2 3 2
cats_g <- cats * 1000
cats_g
## [1] 4765 3230 1256 1780 2583 2781 3945 2345
nums <- c("2,6", "2,71", "3,5", "4,8", "8,9", "9,21")
correct <- as.numeric(gsub(",", ".", nums))
correct
## [1] 2.60 2.71 3.50 4.80 8.90 9.21
country <- rep(c("France", "Italy", "Spain"), each=5)
year <- rep(2000:2004, 3)

dat <- cbind.data.frame(country, year)
dat
v <- c(2, 8, 9, 11, 13, 0)
w <- c(0, 3, 7, 0, 5, 1)
A <- rbind(v, w)
A
##   [,1] [,2] [,3] [,4] [,5] [,6]
## v    2    8    9   11   13    0
## w    0    3    7    0    5    1
B <- cbind(v, w)
B
##       v w
## [1,]  2 0
## [2,]  8 3
## [3,]  9 7
## [4,] 11 0
## [5,] 13 5
## [6,]  0 1
B[3,2]
## w 
## 7
B[4,2] <- 0
B
##       v w
## [1,]  2 0
## [2,]  8 3
## [3,]  9 7
## [4,] 11 0
## [5,] 13 5
## [6,]  0 1
sum(B[2,])
## [1] 11
sum(A[2,])
## [1] 16
sum(B[2,]) < sum(A[2,])
## [1] TRUE