if (interactive()) {
playwith(plot(1:10))
play.first <- playDevCur()
playwith(plot(20:1), new=TRUE)
## show the first window again
playDevSet(play.first)
playDevCur()
## replace it
playwith(plot(1:100))
playDevList()
## clean up
playDevOff()
invisible(lapply(playDevList(), playDevOff))
}
Run the code above in your browser using DataLab