views:

765

answers:

1

How do you pause an R script for a specified number of seconds or miliseconds?

The intended purpose is for self-timed animations. The desired solution works without asking for user input.

+5  A: 

See help(Sys.sleep)

Dirk Eddelbuettel
Here's the example code from that page. To pause for 3.7 secondstestit <- function(x){ p1 <- proc.time() Sys.sleep(x) proc.time() - p1 # The cpu usage should be negligible}testit(3.7)
Dan Goldstein
By the way, help.search("sleep") would have directed you that way.
Dirk Eddelbuettel