[R] How to stop a loop for?

R. Michael Weylandt michael.weylandt at gmail.com
Wed Feb 8 20:50:52 CET 2012

A somewhat common idiom is to use readline() with "Please press
<Return> to continue:" as the prompt and not to store the value


On Wed, Feb 8, 2012 at 2:45 PM, Juan Andres Hernandez
<jhernandezcabrera at gmail.com> wrote:
> Hi all, I have some time trying to find a way to stop a loop for( ) until the
> user presses the enter key or any other one and the loop can continue.
> This could
> be an example:
>  library(MASS)
>  data <- data.frame(mvrnorm(1000,rep(0,5),Sigma=diag(1,5)))
>  for(i in 1:dim(data)[2]){
>  plot(density(data[,i]), main=paste('histogram',i))
>  #here something like waituntil command
>  }
> Thank's in advance
> Juan A. Hernandez
> Spain.
>        [[alternative HTML version deleted]]
> ______________________________________________
> R-help at 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.

More information about the R-help mailing list