Hi, >From ?read.csv
"Alternatively, file can be a readable text-mode connection (which will be opened for reading if necessary, and if so closed (and hence destroyed) at the end of the function call)" HTH, baptiste 2009/10/27 Peng Yu <pengyu...@gmail.com>: > I don't understand why I can not close 'f'. This may be very simple, > but I don't see why. Could somebody let me know? > > $ cat gzfile.csv > "","V1","V2","V3","V4","V5" > "1",1,5,9,13,17 > "2",2,6,10,14,18 > "3",3,7,11,15,19 > "4",4,8,12,16,20 > $ Rscript gzfile.R >> f = file("gzfile.csv") >> A = read.csv(f) >> A > X V1 V2 V3 V4 V5 > 1 1 1 5 9 13 17 > 2 2 2 6 10 14 18 > 3 3 3 7 11 15 19 > 4 4 4 8 12 16 20 >> close(f) > Error in close.connection(f) : invalid connection > Calls: close -> close.connection > Execution halted > > ______________________________________________ > R-help@r-project.org 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. > ______________________________________________ R-help@r-project.org 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.