Professional Documents
Culture Documents
2
7152
ÿ
5047152ÿ
80802ÿÿ
48ÿ144ÿ
8080ÿÿ832ÿ
4ÿÿ8 ! 6! 6"! 6#! 6$! 6 ! 6%! 6&! 6'! 6(!%!%6!%6"!%6#ÿ
4)*ÿ
4) *ÿ
4)&$*ÿ
8080ÿ"ÿ
+,2ÿÿ8ÿ
-.7-!-/14-!-415-!-404-!-404-!-/10-!-2,41-!-380504-!-34,1-!-4141-ÿ
+,2)#5*ÿ
+,2) '*ÿ
8080ÿ#ÿ
/ÿÿ8 ÿ
6ÿÿ8 'ÿ
7ÿÿ8/8"ÿ
/96ÿ
6:/ÿ
/8"968#ÿ
8080ÿ$ÿ
,430;ÿÿ,430555"!#!$!<ÿ=ÿ>/?@ÿ
,430;ÿ
,430;"ÿÿ,430 5 5'!"!$!<ÿ=ÿABÿ
,430;"ÿ
01,430;!,430;"ÿ
,430;:" ÿ
> #Ejercicios R
> #Marco Endara
>
>
> #Ejercicio 1: vectores
>
> a <- c(5,5.1,5.2,5.3,5.4,5.5,5.6,5.7,5.8,5.9,6,6.1,6.2,6.3)
>
> a[1:11]
[1] 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0
>
> a[1:5]
[1] 5.0 5.1 5.2 5.3 5.4
>
> a[7:14]
[1] 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3
>
> #Ejercicio 2
>
> Nombres <- c ('Pepe','Ana','Manolo','Rafa','Maria','Auxi','German','Cecilia','Carmen','Juan')
>
> Nombres[3:10]
[1] "Manolo" "Rafa" "Maria" "Auxi" "German" "Cecilia" "Carmen" "Juan"
>
> Nombres[5:8]
[1] "Maria" "Auxi" "German" "Cecilia"
>
> #Ejercicio 3
>
> A <- c(1:5)
> B <- c(15:18)
>
> D <- c(A^2)
>
> A+B
[1] 16 18 20 22 20
Warning message:
In A + B : longer object length is not a multiple of shorter object length
>
> B*A
[1] 15 32 51 72 75
Warning message:
In B * A : longer object length is not a multiple of shorter object length
>
> (A^2)+(B^3)
[1] 3376 4100 4922 5848 3400
Warning message:
In (A^2) + (B^3) :
longer object length is not a multiple of shorter object length
>
> #Ejercicio 4
>
> matriz1 <- matrix(1001:1012,3,4,byrow = FALSE)
> matriz1
[,1] [,2] [,3] [,4]
[1,] 1001 1004 1007 1010
[2,] 1002 1005 1008 1011
[3,] 1003 1006 1009 1012
>
> matriz2 <- matrix(501:508,2,4,byrow = TRUE)
> matriz2
[,1] [,2] [,3] [,4]
[1,] 501 502 503 504
[2,] 505 506 507 508
>
> rbind(matriz1,matriz2)
[,1] [,2] [,3] [,4]
[1,] 1001 1004 1007 1010
[2,] 1002 1005 1008 1011
[3,] 1003 1006 1009 1012
[4,] 501 502 503 504
[5,] 505 506 507 508
>
> matriz1*25
[,1] [,2] [,3] [,4]
[1,] 25025 25100 25175 25250
[2,] 25050 25125 25200 25275
[3,] 25075 25150 25225 25300
> View(matriz1)
>