0
我有一個.txt數據集,其中所述第一12行文本接着用2個空行,然後將數據fread爲什麼不接受skip命令?
DATE HEIGHT INPUT OUTPUT TESTMEASURE
01/01/1933 NO RECORD NO RECORD MISSING MISSING
01/02/1933 NO RECORD NO RECORD MISSING MISSING
但是,當我做
dat <- fread('data.txt'),
它將跳過15行,和用途第一條數據行作爲導入數據集的列名稱。它忽略標題行。
01/01/1933 NO RECORD NO RECORD MISSING MISSING
跳躍參數沒有影響我在導入所有。我如何提到需要用作列名的行號?或者我可以重命名列名,但不應該忽略第一行數據。
診斷
Input contains no \n. Taking this to be a filename to open
File opened, filesize is 0.001319 GB.
Memory mapping ... ok
Detected eol as \r\n (CRLF) in that order, the Windows standard.
Positioned on line 1 after skip or autostart
This line is the autostart and not blank so searching up for the last non-blank ... line 1
Detecting sep ... '\t'
Detected 5 columns. Longest stretch was from line 15 to line 30
Starting data input on line 15 (either column names or first row of data). First 10 characters: 01/01/1933
The line before starting line 15 is non-empty and will be ignored (it has too few or too many items to be column names or data): DATE HEIGHT INPUT OUTPUT TESTMEASURE the fields on line 15 are character fields. Treating as the column names.
它應該是'dat < - fread('data.txt',skip = 15)'? – CPak
@ChiPak我需要跳過12 + 2 = 14行。但是,下面的任何內容,15,和數據集不受影響。 – maximusdooku
無論我跳過什麼,導入的第一行都是01/02/1933。 – maximusdooku