Hello all,
I apologize if this is simple or has already been answered somewhere, but
I'm not sure what to search for although I have tried and didn't come up
with anything so.. Here's my question.
How can I interpolate list names or do I have to do it post list creation.
Since that's not very clear here is some sample code of what I wanted to do:
> resultlist<-list()
> a<-c("Book", "video", "radio", "mp3")
> foo<-rnorm(10)
> resultlist$a[1]<-foo
Warning message:
In resultlist$a[1] <- foo :
number of items to replace is not a multiple of replacement length
>
What I wanted here was a named list so that I would have 4 values the list
would be
resultlist$Book
resultlist$video
resultlist$radio
resultlist$mp3
Any idea on how to do this other than doing it post creation ie
resultlist[[1]]<-foo
resultlist[[2]]<-rnorm(20) etc..
names(resultlist)<-a
Cheers,
Paul
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.