[R] rename object
Duncan Murdoch
murdoch at stats.uwo.ca
Tue Feb 8 12:41:02 CET 2005
On Tue, 08 Feb 2005 11:36:29 +0100, Eric Lecoutre
<lecoutre at stat.ucl.ac.be> wrote :
>Note though that if you are planning some simulations, many guRus would say
>that you should use a list.
>
>nsimul <- 100
>simOut <- vector(mode="list",length=nsimul)
>names(simOut) <- paste("simu",1:nsimul,sep="")
>
>for (i in 1:nsimul){
> ###
> simOut[i]<- resultsofsimulation.i
> ###
>}
Be careful with those brackets: that should almost certtainly be
simOut[[i]], putting resultsofsimulation.i into the i'th position of
simOut.
Your syntax would put resultsofsimulation.i[[1]] into that place, and
that's not usually what one wants.
Duncan Murdoch
More information about the R-help
mailing list