[R] Loop Repetition

Tolulope Adeagbo to|u|ope@de@gbo @end|ng |rom gm@||@com
Tue Aug 6 10:53:09 CEST 2019


Hey guys,

I'm trying to write a loop that will repeat an action for a stipulated
number of times. I have written some code but i think i'm missing something.

for (x in 5) {

  repeat{

    x = runif(1:4, min = 0, max = 1)


    print(x)


    if (x== var_1[5]){

      print("done")
    }

    print(x)}
}

The goal is to generate the random number 5 times.

Please help....

	[[alternative HTML version deleted]]



More information about the R-help mailing list