Try:

data[,variable]

On Thu, Jun 25, 2009 at 6:44 AM, Anne Skoeries <home@anne-skoeries.de>wrote:

> 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
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]


