[R] accessing a data frame with row names
petr.pikal at precheza.cz
Tue Jun 1 10:36:00 CEST 2010
r-help-bounces at r-project.org napsal dne 01.06.2010 10:20:35:
> On 31/05/2010, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> > Use read.csv or read.table(..., sep = ","). Also note that if you
> > delete the first comma of the header (as in the second example below)
> > you won't have to specify row.names since it can figure it out from
> > the fact that there is one fewer column name than data fields.
> >> Lines <- ",column1,column2
> > + row1,0.1,0.2
> > + row2,0.3,0.4"
> >> read.csv(textConnection(Lines), row.names = 1)
> > column1 column2
> > row1 0.1 0.2
> > row2 0.3 0.4
> Thank you. When I enter the command:
> The response is:
>  0.4
> But I want to receive the row name, i.e.:
>  row2 0.4
It seems that you probably shall consult
?which with parameter arr.ind=T
> Is this possible?
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help