[R] accessing a data frame with row names

e-letter inpost at gmail.com
Tue Jun 1 10:20:35 CEST 2010


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:

max(dataframe[,2])

The response is:

[1] 0.4

But I want to receive the row name, i.e.:

[1] row2 0.4

Is this possible?



More information about the R-help mailing list