[R] variable driven summary of one column
Anne Skoeries
home at anne-skoeries.de
Thu Jun 25 11:44:14 CEST 2009
Hello,
how can I get a variable driven summary of one column of my data.frame?
Usually I would do
> summary(data$columnname) to get a summary of column named
"columnname" of my data.frame named "data".
In my case the columnname is not static but can be set dynamically.
So I save the chosen columname in something like
variable <- "columnname"
but how can I now get the summary of the specified column?
summary(data$get("variable")) doesn't work.
summary(paste("data$", variable, sep="") doesn't work either!
and if I try
summary(data[get("variable)] it gives me back a different result since
the data isn't a factor anymore but a list.
Thanks for the help,
Anne
More information about the R-help
mailing list