Re: [R] How to make R automatic? from Nikhil Kaza on 2010-06-02 (R help archive)

Re: [R] How to make R automatic?

From: Nikhil Kaza <nikhil.list_at_gmail.com>
Date: Tue, 01 Jun 2010 11:41:50 -0400

?difftime
?file.info
file.info(filename)$mtime
Sys.sleep(20)

Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina

nikhil.list_at_gmail.com

On Jun 1, 2010, at 10:07 AM, zhangted001 wrote:

>
> Hello, I have a question about how R can run automatically. Here is
> the
> story:
>
> A file called "data.csv" will be generated every couple of minutes
> in a
> folder (overwrite itself). What I want R to do is:
>
> 1) scan the folder to find the file.
> 2) if the file is a newly generated file, process the file
> 3) output some file identifier on the screen, such as the time when
> the file
> was generated.
> 4) pause for 20 seconds (doesnt need to be precise) and repeat 1)
>
> Idealy, I would like R to do this everyday from 9:00am to 6:00pm.
>
> What I got so far is: I can use list.files() and file.info to get 1)
> and 2).
> For 4), I can write some trivial loop to kill some time, but I would
> like to
> be more accurate tham that, considering different PC running the
> loop. I
> have no idea about 3).
>
> Any suggestion/better solution?
>
> Thank you very much!!
>
> Best regards,
> Ted
>
>
>
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/How-to-make-R-automatic-tp2238541p2238541.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help_at_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_at_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. Received on Tue 01 Jun 2010 - 15:45:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 01 Jun 2010 - 15:50:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive