Well, it's may not be the best way to do so, but you may use this:

colnames(foo[n])

where n is the column number, or the column name inside '' ''.

The $ can't be used because it turn the column content into a vector,
loosing its "properties" (e.g.: column and row names). But when you using
[], these data.frame properties are preserved, so you can extract them.

Hope this helps.

Rodrigo.

2010/5/3 adrien Penac <farfel...@yahoo.fr>

> Hello,
>  I can't find how to get de column name from a data.frame dollar reference.
>
> To make it simple, I'd like to obtain "Bar" from a "foo$Bar" notation.
> I've tried col.names(foo$Bar), names(foo$Bar) and so on without sucess.
>
> Regards
>
> Blaise
>
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to