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 table. I use the command read.csv. If your tables are always small enough to be read in Excel, the limit of number of rows in Excel is about 64000 or something of that sort (maybe 65000 ....) so you can use this number as a limit for your number of rows .... although you may have to "clean-up" your data.frame afterwards. I work on a Windows machine with 4 Gb DRAM - just for comparison. I hope this helps, Monica
<Message: 88<Date: Wed, 29 Aug 2007 10:41:05 -0700<From: "Yuchen Luo" <[EMAIL PROTECTED]><Subject: [R] How to signal the end of the table?<To: r-help@stat.math.ethz.ch<Message-ID:<<[EMAIL PROTECTED]><<Content-Type: text/plain<<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 1:number.of.record){<<current.row=scan(file=fp, sep=',', what=list(count=1, cusip6="", idate=1,<spread=1.1, vol252=1.1, vol1000=1.1, st_debt=1.1, lt_debt=1.1 , total_liab=<1.1, cr=1.1, shrout=1.1, prc=1.1, mkt_cap=1.1, rtng=1.1, sec=1.1, cr3m=1.1,<cr5y=1.1, ust3m=1.1, ust5y=1.1), flush=TRUE, nlines=1,quiet=T)<<...<<}<<<<I need to know the number of records in the table and put it in the variable<named "nu! mber.of.records". When I have a new table that I do not know how<many records it has, I use excel to open the file to figure it out and put<it in variable " number.of.records". I often have many tables to try and<every one of them has thousands of records----it takes a lot of time and<trouble to adjust the code every time I read a different table.<<<<I am wondering if I can change the "for" loop to a "while" loop:<<<<while (the end of the table has not been reached)<<{<<current.row=scan(file=fp, sep=',', what=list(count=1, cusip6="", idate=1,<spread=1.1, vol252=1.1, vol1000=1.1, st_debt=1.1, lt_debt=1.1 , total_liab=<1.1, cr=1.1, shrout=1.1, prc=1.1, mkt_cap=1.1, rtng=1.1, sec=1.1, cr3m=1.1,<cr5y=1.1, ust3m=1.1, ust5y=1.1), flush=TRUE, nlines=1,quiet=T)<<...<<}<<<The problem is how to articulate "while (the end of the table has not been<reached)", or equivalently, how to signal the end of the table?<<Best Wishes<Yuchen Luo<< [[alternative HTML version deleted]]< _________________________________________________________________ Discover the new Windows Vista [[alternative HTML version deleted]] ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.