Use skip=
parameter in read.table
read.table("file.txt",skip= ,nrows= )
Both the skip=
and nrows=
take in row indicator numbers so just add them after the=.
The nrows=
defines how deep you range when you are importing the file.
I suggest reading https://stat.ethz.ch/R-manual/R-devel/library/utils/html/read.table.html if you haven't done so already.
Also, please see one of my questions:
R - Reading lines from a .txt-file after a specific line
It, somewhat, touches the same subject.
The other possible way might be to use grep()
in skip=
read.table(...,skip=grep("2005-12-31", readLines("File.txt")),nrows=365)
What this line does is it skips until it finds the line depicted in grep()
and reads the lines after that. The nrow=
will stop the reading after it has read 365 lines (this way you have read one year of dates provided one line equals one date).
This seems kinda complicated, but it's the only way I know how to solve this.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…