v_apple<-c(120, 125, 130)
v_google<-c(1800, 1850, 1900)
v_amazon<-c(3200, 3300, 3400)
acciones<-list(apple=v_apple,
google=v_google,
amazon=v_amazon)
acciones
## $apple
## [1] 120 125 130
##
## $google
## [1] 1800 1850 1900
##
## $amazon
## [1] 3200 3300 3400
## $apple
## [1] 120 125 130
##
## $google
## [1] 1800 1850 1900
##
## $amazon
## [1] 3200 3300 3400
##
## $microsoft
## [1] 210 215 220
indicadores<-list(pib=30000,
inflacion=c(2.5,3.0,3.5),
desempleo=matrix(c(5.0,5.5,6.0,4.5,4.0,3.5), nrow = 2),
deuda=list(publica=60,
privada=40))
indicadores
## $pib
## [1] 30000
##
## $inflacion
## [1] 2.5 3.0 3.5
##
## $desempleo
## [,1] [,2] [,3]
## [1,] 5.0 6.0 4.0
## [2,] 5.5 4.5 3.5
##
## $deuda
## $deuda$publica
## [1] 60
##
## $deuda$privada
## [1] 40
estudiantes<-list(nombre = c("Ana","Luis", "Pedro"),
edad = c(18, 19, 20),
notas = list(matematicas = c(8, 7, 9),
historia = c(6, 8, 7),
ingles = c(9, 10, 8)))
estudiantes
## $nombre
## [1] "Ana" "Luis" "Pedro"
##
## $edad
## [1] 18 19 20
##
## $notas
## $notas$matematicas
## [1] 8 7 9
##
## $notas$historia
## [1] 6 8 7
##
## $notas$ingles
## [1] 9 10 8
length(estudiantes)<-4
estudiantes[[4]]<-c("F", "M", "NB")
names(estudiantes)[4]<-"genero"
estudiantes
## $nombre
## [1] "Elena" "Luis" "Pedro"
##
## $edad
## [1] 18 19 20
##
## $notas
## $notas$matematicas
## [1] 8 7 9
##
## $notas$historia
## [1] 6 8 7
##
## $notas$ingles
## [1] 9 10 8
##
##
## $genero
## [1] "F" "M" "NB"
a1<-list(a11=c(1,2,3), a12=c(4,5,6))
a2<-list(a21=c(7,8,9), a22=c(10,11,12))
b1<-list(b11=c(13,14,15), b12=c(16,17,18))
b2<-list(b21=c(19,20,21), a22=c(22,23,24))
lista_4<-list(a=list(a1=a1,a2=a2), b=list(b1=b1,b2=b2))
lista_4
## $a
## $a$a1
## $a$a1$a11
## [1] 1 2 3
##
## $a$a1$a12
## [1] 4 5 6
##
##
## $a$a2
## $a$a2$a21
## [1] 7 8 9
##
## $a$a2$a22
## [1] 10 11 12
##
##
##
## $b
## $b$b1
## $b$b1$b11
## [1] 13 14 15
##
## $b$b1$b12
## [1] 16 17 18
##
##
## $b$b2
## $b$b2$b21
## [1] 19 20 21
##
## $b$b2$a22
## [1] 22 23 24
## $sub_lista_b
## $sub_lista_b$b11
## [1] 13 14 15
##
## $sub_lista_b$b12
## [1] 16 17 18
##
##
## $b2
## $b2$b21
## [1] 19 20 21
length(lista_4)<-3
c11<-matrix(data = c(1,0,0,0,1,0,0,0,1), nrow = 3, byrow = TRUE)
c12<-matrix(data = c("","","",""), nrow = 2)
c=list(c11=c11, c12=c12)
lista_4[[3]]<-c
names(lista_4)[[3]]<-"c"
lista_4
## $a
## $a$a1
## $a$a1$a11
## [1] 1 2 3
##
## $a$a1$a12
## [1] 4 5 6
##
##
## $a$a2
## $a$a2$a21
## [1] 7 8 9
##
## $a$a2$a22
## [1] 10 11 12
##
##
##
## $b
## $b$sub_lista_b
## $b$sub_lista_b$b11
## [1] 13 14 15
##
## $b$sub_lista_b$b12
## [1] 16 17 18
##
##
## $b$b2
## $b$b2$b21
## [1] 19 20 21
##
##
##
## $c
## $c$c11
## [,1] [,2] [,3]
## [1,] 1 0 0
## [2,] 0 1 0
## [3,] 0 0 1
##
## $c$c12
## [,1] [,2]
## [1,] "" ""
## [2,] "" ""