[R] Confused about appending to list behavior...

Dieter Menne dieter.menne at menne-biomed.de
Fri Feb 19 15:46:35 CET 2010



JustADude wrote:
> 
> 
> ...
> 
> By any chance is there more documentation out there on lists and this
> behavior, as I would like to try to better understand what is really going
> on and why one approach works and another doesn't.   
> 
> ...
>  Example reproduced below
> 

You forgot an assign. 

Dieter

example_list<-list(tracking<-c("house"), 
house_type<-c("brick", "wood"), sizes<-c(1600, 1800, 2000, 2400))
example_list
cost_limits<-c(200000.25, 350010.15)
example_list[[4]]<-cost_limits
example_list
# you forgot the left side here
# c(example_list,list(CostStuff=cost_limits))
# Should be
example_list <- c(example_list,list(CostStuff=cost_limits))
example_list$CostStuff
example_list[[5]]




-- 
View this message in context: http://n4.nabble.com/Confused-about-appending-to-list-behavior-tp1561547p1561723.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list