### Asignación de variables
x <- 3
y <- 2x## [1] 3
y## [1] 2
suma <- x+y
suma## [1] 5
resta <- x-y
resta## [1] 1
multiplicacion <- x*y
multiplicacion## [1] 6
division <- x/y
division## [1] 1.5
division_entera <- x%/%y
division_entera## [1] 1
residuo <- x%%y
residuo ## [1] 1
potencia <- x^y
potencia ## [1] 9
#Funciones matematicas
raiz_cuadrada <- sqrt(x)
raiz_cuadrada## [1] 1.732051
raiz_cubica <- x^(1/3)
raiz_cubica## [1] 1.44225
exponencial <- exp(1)
exponencial## [1] 2.718282
absoluto <- abs(x)
absoluto## [1] 3
signo <- sign(x)
signo## [1] 1
redondeo_arriba <- ceiling(division)
redondeo_arriba## [1] 2
redondeo_abajo <- floor(division)
redondeo_abajo## [1] 1
truncar <- trunc(division)
truncar## [1] 1
pi## [1] 3.141593
radio <- 5
area_circulo <- pi*radio^2
area_circulo## [1] 78.53982
a <- c(1,2,3,4,5)
a## [1] 1 2 3 4 5
b <- c(1:100)
b## [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
## [19] 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
## [37] 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
## [55] 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
## [73] 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
## [91] 91 92 93 94 95 96 97 98 99 100
c <- c("pera, mango, manzana, kiwi, fresa")
c## [1] "pera, mango, manzana, kiwi, fresa"
longitud <- length(a)
longitud## [1] 5
promedio <- mean(a)
promedio ## [1] 3
resumen <- summary(a)
resumen ## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1 2 3 3 4 5
orden_Ascendente <- sort(a)
orden_Ascendente## [1] 1 2 3 4 5
orden_descendente <- sort(a,decreasing = TRUE)
orden_descendente## [1] 5 4 3 2 1
d <- c(1,2,3,4,5)
d## [1] 1 2 3 4 5
suma_vectores <- a+d
suma_vectores## [1] 2 4 6 8 10
plot(a,d, main="ventas por mes", xlab="Mes", ylab="Millones USD", type ="b")