[R] problem with get command
Gabor Grothendieck
ggrothendieck at gmail.com
Thu Apr 27 02:06:59 CEST 2006
ov$vn1 is not a variable. It is the result of applying the $ function to
the ov and vn1 arguments.
For example, using BOD which is a data frame that comes with R,
rather than get("BOD$Time") use get("BOD")[["Time"]]
On 4/26/06, Thomas Davidoff <davidoff at haas.berkeley.edu> wrote:
> I don't understand what my error is in the following:
> I need to use the get command on a series of variables, but can't for
> some reason that I don't understand. Why am I told no such variable as
> ov$vn1 after getting a summary report on that very variable?
> > summary(ov$vn1)
> Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
> 1.0 25.0 81.0 468.1 450.0 159100.0 6050.0
> > dvars <- paste("ov$dvn", 1:4, sep="")
> > vars <- c("ov$vn1","ov$vn2","ov$vn3","ov$vn4")
> > summary(get(vars[1]))
> Error in get(x, envir, mode, inherits) : variable "ov$vn1" was not found
> Execution halted
>
>
>
> Thomas Davidoff
> Assistant Professor
> Haas School of Business
> UC Berkeley
> Berkeley, CA 94618
> Phone: (510) 643-1425
> Fax: (510) 643-7357
> email: davidoff at haas.berkeley.edu
> web: http://faculty.haas.berkeley.edu/davidoff/
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list