The R Project SVN R

Rev

Rev 70399 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 70399 Rev 74519
Line 61... Line 61...
61
}
61
}
62
 
62
 
63
## gzfile and gzcon can inter-work.
63
## gzfile and gzcon can inter-work.
64
## Of course here one would use gzfile, but file() can be replaced by
64
## Of course here one would use gzfile, but file() can be replaced by
65
## any other connection generator.
65
## any other connection generator.
-
 
66
zzfil <- tempfile(fileext = ".gz")
66
zz <- gzfile("ex.gz", "w")
67
zz <- gzfile(zzfil, "w")
67
cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
68
cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
68
close(zz)
69
close(zz)
69
readLines(zz <- gzcon(file("ex.gz", "rb")))
70
readLines(zz <- gzcon(file(zzfil, "rb")))
70
close(zz)
71
close(zz)
71
unlink("ex.gz")
72
unlink(zzfil)
-
 
73
 
72
% Cygwin seems to require a different name
74
% Cygwin seems to require a different name
-
 
75
zzfil2 <- tempfile(fileext = ".gz")
73
zz <- gzcon(file("ex2.gz", "wb"))
76
zz <- gzcon(file(zzfil2, "wb"))
74
cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
77
cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
75
close(zz)
78
close(zz)
76
readLines(zz <- gzfile("ex2.gz"))
79
readLines(zz <- gzfile(zzfil2))
77
close(zz)
80
close(zz)
78
unlink("ex2.gz")
81
unlink(zzfil2)
79
}
82
}
80
\keyword{file}
83
\keyword{file}
81
\keyword{connection}
84
\keyword{connection}