
Basic Commands
Impresion de Resultados
## [1] 3
## [1] 2
Operaciones Aritmeticas
## [1] 5
## [1] 1
multiplicacion=x*y
multiplicacion
## [1] 6
## [1] 1.5
division_entera=x%/%y
division_entera
## [1] 1
## [1] 1
## [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
## [1] 3
## [1] 1
redondeo_arriba=ceiling(division)
redondeo_arriba
## [1] 2
redondeo_abajo=floor(division)
redondeo_abajo
## [1] 1
truncar=trunc(division)
truncar
## [1] 1
Constantes
## [1] 3.141593
radio=5
area_circulo=pi*radio^2
area_circulo
## [1] 78.53982
Vectores
## [1] 1 2 3 4 5
## [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
## function (object, ...)
## UseMethod("summary")
## <bytecode: 0x0000023716d31590>
## <environment: namespace:base>
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
## [1] 1 2 3 4 5
suma_vectores=a+d
suma_vectores
## [1] 2 4 6 8 10
Graficar
plot(a,d,main='Ventas por mes',xlab='Mes', ylab='Millones USD',type='b')
