[R] Why I get this error? Error in close.connection(f) : invalid connection

Peng Yu pengyu.ut at gmail.com
Tue Oct 27 23:22:25 CET 2009


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




More information about the R-help mailing list