On Wed, 8 Mar 2006, [EMAIL PROTECTED] wrote:
>
> I thought I coudl simply use something line this:
>
> con <- file("test2.txt");
> do {
>    e <- read.table(con, nlines = 1);
>    if ( length(e) == 2 ) {
>       d <- read.table(con, nrows = e[1,2]);
>       #process data frame d
>    }
> } while (length(e) == 2);
>
> The problem is that read.table closes the connection object, I assumed 
> that it would not close the connection, and instead contines where it 
> last stopped.

I think the problem is just that you didn't open the connection before 
passing it to read.table.

?file says "By default the connection is not opened"
and
?read.table says
           Alternatively, 'file' can be a 'connection', which will be
           opened if necessary, and if so closed at the end of the
           function call.



        -thomas

______________________________________________
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

Reply via email to