[R] Appending Data to A n Existing List...

David Winsemius dwinsemius at comcast.net
Fri Feb 19 00:33:00 CET 2010


On Feb 18, 2010, at 6:15 PM, Jason Rupert wrote:

> What steps can be take to append data to a list?
>
> Suppose I have the following list and want to append a z axist to  
> the list?
>
> pts <- list(x=cars[,1], y=cars[,2])
>
> z<-rnorm(max(dim(cars)))
>
> How would I go about appending z to an existing list?

"Appending" is a bit vague, but why not:

pts$z <- z   # waht I think you meant

?  or

pts[[3]] <- z   # not exactly the same and probably not what you wanted


-- 
David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list