here is list1, only tow elements–“name” and “age” in it,there are two value in every element ,now i want to add new value in every element,
list1<-list(name=c("bob","john"),age=c(15,17))
list1
$name
[1] "bob" "john"
$age
[1] 15 17
list1[[1]][3]<-"herry"
list1[[2]][3]<-17
list1
$name
[1] "bob" "john" "herry"
$age
[1] 15 17 17
is there more simple way to do ?
This solution works for lists of any length: