I want to prepare a demo (that will play sequentially in clicks) for a presentation tutorial…Can somebody help me how can I write a demo, suppose the following are steps in the demo…
#start
set.seed(1345)
x1 <- sample(letters[1:10], 5)
x1
sort(x1)
x <- sample(1:10, 5)
y <- sample(c(11:20), 5)
require(lattice)
plot(x,y)
z <- rnorm(5, 1, 0.5)
dataframe <- data.frame(x, y, z)
model1 <- lm(y ~x)
aov(model1)
#end
Sorry I could find a solution after hours and days of search. I appreciate your help.
Another way to do it:
demo.R)pause()in strategic placespause <- function() invisible(readline())source("demo.R", echo=TRUE)It will then print & run your commands and stop and wait for input at the sprinkled
pause(). Just hit<Enter>to continue.EDIT: I don’t know a good way to hide the
pause()statement. A possible way would be to copy the code forsource()and modify it to skip printing calls topause(), but that’s a little overkill I think……but you could rename the pause function to anything you like – including
'....', but you still need to call it like this:....()Hmmm. Maybe something like this:
Then sprinkle your script with either:
Another possibility if you rename the pause function to
Pausing...: