c(120, 125, 130)->Apple
c(1800, 1850, 1900)->Google
c(3200, 3300, 3400)->Amazon
Acciones<-list(Apple=Apple, Google=Google, Amazon=Amazon)
print(Acciones)
## $Apple
## [1] 120 125 130
##
## $Google
## [1] 1800 1850 1900
##
## $Amazon
## [1] 3200 3300 3400
c(3000)->PIB
c(2.5, 3.0, 3.5)->inflacion
matrix(c(5.0, 5.5, 6.0, 4.5, 4.0, 3.5), nrow = 2)->desempleo
c(60)->publica
c(40)->privada
deuda<-list(publica= publica, privada= privada)
indicadores<-list(PIB= PIB, inflacion= inflacion, desmpleo= desempleo, deuda= deuda)
print(indicadores)
## $PIB
## [1] 3000
##
## $inflacion
## [1] 2.5 3.0 3.5
##
## $desmpleo
## [,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)))
print(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
## [1] "F" "M" "NB"
lista_4<-list(a=list(a1=a1<-list(a11=c(1, 2, 3), a12=c(4,5,6)),a2=a2<-list(a21=c(7, 8, 9),a22=c(10,11,12))),b=list(b1=b1<-list(b11=c(13,14,15),b12=c(16,17,18)), b2=b2<-list(b21=c(19, 20, 21), b22=c(22, 23, 24))))
print(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$b22
## [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
##
## $b2$b22
## [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
c<-list(c11=matrix(c(1,0,0,0,1,0,0,0,1),nrow = 3, byrow = TRUE),c12=matrix(c(0,0,0,0), nrow = 2))
length(lista_4)<-3
lista_4[[3]]<-c
names(lista_4)[[3]]<-"c"
print(lista_4$c)
## $c11
## [,1] [,2] [,3]
## [1,] 1 0 0
## [2,] 0 1 0
## [3,] 0 0 1
##
## $c12
## [,1] [,2]
## [1,] 0 0
## [2,] 0 0