[R] read.table or read.csv without row index?

vincent.deluard vincent.deluard at trimtabs.com
Wed May 5 21:29:01 CEST 2010


Hi,

I have the same problem as Wong.

I have a csv file that contains weather observation (rows) by days (in
columns).

I open using:

> temp = read.csv("Weather.csv", sep=",")

and read:

             X X1.Jan X2.Jan X3.Jan X4.Jan
1          Min      2      3      4      1
2          Max      6     10      8      6
3 Forecast Min      3      1      1      3
4 Forecast Max      8      7      4      9 

If I type

mean(temp[2,2:3])

I get

X1.Jan X2.Jan 
     6     10 

The same command on 

> y = matrix(1:21, ncol=7)

> mean(y[2,2:3])
[1] 6.5

works because the data is in a matrix. So how do I convert the data from my
csv file into a matrix?
I tried as.matrix but it did not help.


Many many thanks! 

-- 
View this message in context: http://r.789695.n4.nabble.com/read-table-or-read-csv-without-row-index-tp883594p2131537.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list