[R] accessing information in data.frame
Uwe Ligges
ligges at statistik.uni-dortmund.de
Tue Nov 27 14:56:39 CET 2001
"Dr. Berthold Kramm" wrote:
>
> After reading a data.frame using, such as a <- read.spss("data.sav")
> I want to give the column index 'i', or a[i] to a function, which after
> some calculation, should print out the results to the standard output.
>
> I am struggling how to access the data itself, as e.g. sum(a[i])
sum(a[,i])
> does
> not work in this context. In addition I need to know the name of the
> variable within the function in order to generate a meaningful output,
> and have not found any way to obtain the name of the variable.
deparse(substitute(x))
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list