[R] row names, coulmn names

Tom Wright tom at maladmin.com
Sun May 1 20:56:48 CEST 2016


I think what you ask isn't ideal.Each column in a dataframe should be the
same data type. While column names are stored in the first row when the df
is exported to CSV, they are not stored as columns in the data frame.
Instead the column names are stored as a separate attribute of the df. This
is why you need to use names(df) to access them, not df[1,]. I don't have
access to R right now, but I think ?attributes or ??"attributes" should
point you in the correct direction.

On Sun, May 1, 2016, 11:11 AM Jan Kacaba <jan.kacaba at gmail.com> wrote:

> Hello dear R helpers,
>
> Is it possible to have more than 1 row for column names in data.frame,
> array, tbl_df? I would like to have column numbers in the first row, string
> names in the second row, physical unit in third row.
> How would I do it?
>
> Derek
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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]]



More information about the R-help mailing list