Skip to content
Prev 293793 / 398503 Next

Repeating

Hello,


efulas wrote
What is the error message? Without it it's not possible to say, exactly,
but:

1. What is the varible 'reassign'? You use it before it's created. The
instruction

    reassign[i]<-matrix( ...etc...

    changes a value that should already exist. This should produce an error.
    (By seeing how 'reassign' is used, you're creating a matrix, get rid of
the index in reassign[i].)

2. What is 'f'? You're creating it, then recreating it but never using it.
Get rid of it.

3. Every time through the loop you attribute a new value to 'random.g', and
only the last one is
    returned by the function. If you want all n values, this would be
better:

    random.g <- vector("list", n)
    for(i in seq.int(n)){

        [... etc ...]

        random.g[[ i ]] <- ((g$y)^2)/pi 
    }


Hope this helps,

Rui Barradas


--
View this message in context: http://r.789695.n4.nabble.com/Repeating-tp4614371p4614823.html
Sent from the R help mailing list archive at Nabble.com.