How can I read the header but also skip lines - read.table()?

后端 未结 5 793
谎友^
谎友^ 2020-12-01 09:17

Data.txt:

Index;Time;
1;2345;
2;1423;
3;5123;

The code:

dat <- read.table(\'data.txt\', skip = 1, nrows = 2, header =TRU         


        
5条回答
  •  无人及你
    2020-12-01 09:56

    You're using skip incorrectly. Try this:

    dat <- read.table('data.txt', nrows = 2, header =TRUE, sep =';')[-1, ]
    

提交回复
热议问题