3
The figures after ^ (1, 2 and 3) are the values I wish to automate (increasing: from 1 to ith value):
var1<-rnorm(3,5000,1300)/1.15^1
var2<-rnorm(3,5000,1300)/1.15^2
var3<-rnorm(3,5000,1300)/1.15^3
But, automate within a loop for:
for(i in 1:10){
name<-paste0('var',i)
assign(name,rnorm(3,5000,1300)/1.15^1)
}
How to insert this automation into the loop for and avoid writing one function at a time?
It’s not just replacing
1.15^1for1.15^i?– Marcus Nunes