This is probably quite a simple problem, but Im quite new to R. I have a for loop,
holder<-rep(0,3)
for(i in 1:3) {
apple<-c(i+1, i*2, i^3)
holder[i]<-apple
}
I get the warning message:
Warning messages:
1: In holder[i] <- apple :
number of items to replace is not a multiple of replacement length
2: In holder[i] <- apple :
number of items to replace is not a multiple of replacement length
3: In holder[i] <- apple :
number of items to replace is not a multiple of replacement length
So what I tried to do is set holder as a matrix, instead of a vector. But I am unable to complete it. Any suggestions would be greatly appreciated.
Best,
James