mardi 13 mai 2014

R stats - generate incremental variables


Vote count:

0




I am quite new in R programming and facing a simple problem but can't find any solution.


In other programming languages, it is possible to generate incrementally named variables into a loop. Is it possible in R ? How ?


For example, I would like to save the output of an operation into a new variable each time a loop is done:



for(i in 1:5) {
var_[i] <- i + pi
}


In this way, I would end up with var_1, var_2,..., var_5.


Thank you in advance for any help


SaS



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire