La primera práctica de que vamos a hacer es sumar.
5+10
## [1] 15
74*460
## [1] 34040
Vamos a generar mi primer base de datos
Base1 <- cbind(Color_pelo = "cafe", "Cafe", "Negro", "Amarillo", "Calvo",
Altura = 180, 150, 168, 175, 175)
Base1
## Color_pelo Altura
## [1,] "cafe" "Cafe" "Negro" "Amarillo" "Calvo" "180" "150" "168" "175"
##
## [1,] "175"
Vamos a hacer alguna función simple
funcion1 <- function(a,b,c){
variable <- a+b+c
print(variable)
}
funcion1(100,200,3000)
## [1] 3300
Ahora vamos a hacer otra función más compleja
funcion2 <- function(a,b,c) {
variable1 <- a * b
variable2 <- variable1 / c
print(variable2)
}
funcion2(2,2,2)
## [1] 2