I don't know if this code match what you want. You should use tcltk library.
code:
library(tcltk)
z <- function () { cat("Hello you!\n"); .id <<- tcl("after", 1000, z)}
z()

If you want to cancel you can use:
.id <<- tcl("after", 1000, z)
tcl("after", "info", .id)   # To get info about this scheduled task
tcl("after", "cancel", .id) # To cancel the currently scheduled task

Regard,
Agus MS

On Mon, Dec 19, 2011 at 11:10 PM, Kenneth Zhang <kennethrrr@gmail.com>wrote:

> I'd like to run an R code automatically on Windows 7, say once every 2
> hours. Could anyone tell me how to manage it?
>
> Thanks in advance!
>
> Best regards,
> Ken
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>

	[[alternative HTML version deleted]]

