-4

I have the following CSV file:

D1                Diff
20/11/2014 16:00    0
20/11/2014 17:00    0.01
20/11/2014 18:00    0.04
20/11/2014 19:00    0.03

Where D1 is a date with time. When I use the following command:

ts1<-read.csv (file.choose(), row.names=1 )

result:

> head (ts1)
                 Diff
20/11/2014 16:00 0.00
20/11/2014 17:00 0.01
20/11/2014 18:00 0.04
20/11/2014 19:00 0.03
20/11/2014 20:00 0.02
20/11/2014 21:00 0.03

Why does the first column header (D1) is ignored?

jogo
  • 12,469
  • 11
  • 37
  • 42
Avi
  • 2,247
  • 4
  • 30
  • 52
  • 2
    Because row names are not a column. By specifying `row.names=1` the first column in the csv file is converted into the name of the rows. – RHertel Jan 10 '16 at 12:25
  • 2
    should be: ts1<-read.csv (file.choose()). `row.names=1` use the 1st column as rownames. – Ven Yao Jan 10 '16 at 12:26

1 Answers1

4

Column 1 is not ignored. You asked read.csv to make it into rownames.

Roman Luštrik
  • 69,533
  • 24
  • 154
  • 197