I am using a for loop to read a table row by row and I have to specify how
many records are there in the table. I need to read row by row because the
table is huge and the memory not large enough for the whole table.:
number.of.records=100
fp=file(abc.csv,r)
pos=seek(fp, rw=read)
for (i in
What about trying to use a database system and make queries?
If you are at the end of a file, you will read elements of length 0...
Uwe Ligges
Yuchen Luo wrote:
I am using a for loop to read a table row by row and I have to specify how
many records are there in the table. I need to read row
Have you tried read.table() and the similar functions? I think they
would provide a much more simple solution for your problem.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research
Well, i am surprise you have problems to read a table that is small enough to
be opened entirely in Excel.
I work with csv tables with hundreds of thousands of rows, and sometimes even
millions with no problems except that sometimes i have to wait up to 1 or
2 minutes for R to read the
For example,
fp-file(abc.csv,r)
c.row-scan(file=fp,sep=,,nlines=1) # what argument is omitted for
bevity as it doesn't matter
rows-c.row
while(length(c.row)0) {
c.row-scan(file=fp,sep=;,nlines=1);
rows-rbind(rows,c.row)
}
close(fp)
If you want to read a file by parts, then you do