[R] Odp: Problem with retrieving updated variables after attach()
Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Tue Feb 10 13:48:02 CET 2009
David Croll wrote:
> Well, I knew that attach() only creates a copy of the variables in the
> search path.
> What I wanted to ask was how to *retrieve* that copy...
> > mat
> id age
> 1 NA NA
> 2 NA NA
> 3 NA NA
> 4 NA NA
> 5 NA NA
> > attach(mat)
> > id <<- sample(100,5)
> > age <<- rnorm(5,mean=30)
> How can I make a new data frame out of the id and age that were
> changed above?
data.frame(id, age) # from the copy
data.frame(mat$id, mat$age) # from the originals
why do you need to overwrite the copy?
More information about the R-help