Re: [R] accessing a data frame with row names

2010-06-01 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 01.06.2010 10:20:35: > On 31/05/2010, Gabor Grothendieck 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 sinc

Re: [R] accessing a data frame with row names

2010-06-01 Thread e-letter
On 31/05/2010, Gabor Grothendieck 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

Re: [R] accessing a data frame with row names

2010-05-31 Thread Ivan Calandra
Hi, Let's create your data.frame: > dataframe <- structure(list(column1 = c(0.1, 0.3), column2 = c(0.2, 0.4)), .Names = c("column1", "column2"), row.names = c("row1", "row2"), class = "data.frame") > dataframe[,2] [1] 0.2 0.4 > dataframe[,2, drop=FALSE] column2 row1 0.2 row2 0.4 S

Re: [R] accessing a data frame with row names

2010-05-31 Thread Gabor Grothendieck
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 +

[R] accessing a data frame with row names

2010-05-31 Thread e-letter
Readers, I have entered a file into r: ,column1,column2 row1,0.1,0.2 row2,0.3,0.4 using the command: dataframe<-read.table("/path/to/file.csv",header=T,row.names=1) When I try the command: dataframe[,2] I receive the response: NULL I was expecting: row1 0.2 row2 0.4 What is my error with