Skip to content
Prev 324540 / 398503 Next

How to read a file including strings and numbers.

Hello,

Just use ?read.csv with argument header = FALSE.


wnd_data <- read.csv(text = '
"2012-08-07 00:00:00",4174830,5,8.1,34.5,9.5,32,14
"2012-08-07 00:00:01",4174831,4.7,8.6,34.5,9.9,29,14
"2012-08-07 00:00:02",4174832,4.7,8.6,34.5,9.9,29,14
"2012-08-07 00:00:03",4174833,5,8.5,34.5,9.8,30,14
"2012-08-07 00:00:04",4174834,5,8.5,34.5,9.8,30,14
"2012-08-07 00:00:05",4174835,5.4,8.3,34.6,9.9,33,14
"2012-08-07 00:00:06",4174836,5.4,8.3,34.6,9.9,33,14
"2012-08-07 00:00:07",4174837,5.1,7.8,34.5,9.3,33,14
"2012-08-07 00:00:08",4174838,5.1,7.8,34.5,9.3,33,14
"2012-08-07 00:00:09",4174839,5.3,7.8,34.5,9.4,34,14
"2012-08-07 00:00:10",4174840,5.3,7.8,34.5,9.4,34,14
"2012-08-07 00:00:11",4174841,5.4,8.3,34.5,9.9,33,14
"2012-08-07 00:00:12",4174842,5.4,8.3,34.5,9.9,33,14
"2012-08-07 00:00:13",4174843,5.6,8.3,34.5,10,34,14
"2012-08-07 00:00:14",4174844,5.6,8.3,34.5,10,34,14
"2012-08-07 00:00:15",4174845,5.5,8.1,34.5,9.8,34,14
"2012-08-07 00:00:16",4174846,5.5,8.1,34.5,9.8,34,14
"2012-08-07 00:00:17",4174847,4.3,7.4,34.4,8.6,30,14
', header = FALSE)

str(wnd_data)


Note also that your vector of column names is of length 10 and there are 
only 8 columns.

Hope this helps,

Rui Barradas

Em 01-06-2013 08:54, Jie Tang escreveu: