Really basic question but I can't find an answer - I've probably misunderstood lists in R
Can you have multiple 'nested' items held in a list? This is fine:
cats<-c("red", "blue", "yellow")
l1<-list()
for(i in cats){
l1[i][1]<-"hello"
};l1
This is not:
for(i in cats){
l1[i][2]<-"goodbye"
};l1
The output I have in mind would mean
l1$red[1]
is "hello"
and l1$red[2]
is "goodbye"
Am I setting the list up incorrectly? Or is the entire concept flawed?
Thanks