[R] problem with get command

Thomas Davidoff davidoff at haas.berkeley.edu
Thu Apr 27 01:49:50 CEST 2006

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/

More information about the R-help mailing list