Change variable name in for loop using R -


i have loop:

for (i in 1:10){ ai=d+rnorm(3)} 

what have a1, a2,a3...a10 , have variable i in variable name.

it doesn't work way, i'm missing small thing. how can use i in loop assign different variable names?

d <- 5 for(i in 1:10) {   nam <- paste("a", i, sep = "")  assign(nam, rnorm(3)+d) } 

more info here or here!


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -