Does R has a GO TO function? For example, I want to run this script at a given 
interval and save the results.
 
#Step one
a <- Sys.time()
b <- paste("Figure_", a, sep = " ") 
shape <- as.numeric(a)/100000000
scale <- as.numeric(a)/10000000000
#I want to save the file using "b" object (above) as a file name
#However it is saved as b.pdf
pdf("f:/b.pdf") #How to save the file using "b" above?
par(mfrow=c(2,1))
x <- sort(rgamma(100, shape=shape, scale = scale))
y <- dgamma(x, shape=shape, scale = scale)
par(mfrow=c(2,1))
plot(x, y, type="l",col="red", lwd=5)
 
#Step 2
Sys.sleep(2) # For Quick results in the model it is one hour 
shape <- (as.numeric(Sys.time()))/100000000
scale <- (as.numeric(Sys.time()))/10000000000
x <- sort(rgamma(100, shape=shape, scale = scale))
y <- dgamma(x, shape=shape, scale = scale)
plot(x, y, type="b",col=" dark red", lwd=5)
dev.off()
#Step 3
Sys.sleep(2) Again in the model it is one hour
#I Want to go back to step 1 to start over again


Sincerely,

Peter Maclean
Department of Economics
UDSM
        [[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.

Reply via email to