[R] about sink and scan
Michael S
michael_shen at hotmail.com
Tue May 10 09:48:02 CEST 2005
Hi All r-helper,
my question like this:
I use "sink" function to get output into one file,during the sink process ,
output keep writing into this file,I want to check is there any new output
write into this file(which "sink function create"), using "scan" function to
read new output from that file.
if I use the cat with "\n" ,and scan(....,skip=linenumber) ,I can get what I
want.but I just use "cat" without "\n",every new output just append at the
end of last output. I can not use skip option in scan function . what should
I do ?
I know file.info(..)$size can get current size of file. but how can I check
which is new output or old one within the same line ,then scan the latest.
example:
sink('test.txt')
cat("r sink")
scan('text.txt',what='character',blank.lines.skip=FALSE,sep='\\n',skip=0,quiet=TRUE)
cat("htuierghtue")
scan#this time I just want to scan the "htuierghtue"
sink()
thanks in advance
More information about the R-help
mailing list