0
Hello, I think my question is very simple, but come on:
How do I make such a move:
coef.matrix=matrix(0,4,16)
for (k in c(1,4)){
for(i in 1:2){
coef.matrix[i,1]=summary(lm(y ~ x))$coef[2,k]
}
}
Instead of "1 to 4" I would like to include "1 or 4". You can do this within parentheses or I will need to call the if / else
?
you are wanting to make a
for
or aif
?– Daniel Falbel
If it’s 1 and 4, you use it, like: for (i in c(1,4)){ expression}, but if it’s 1 or 4, you’ll probably use if.
– José
Guys, thanks for editing the code. @Danielfalbel
– Laura