I'm trying to write from a loop to a data frame in R, for example a loop like this>
for (i in 1:20) {
print(c(i+i,i*i,i/1))}
and to write each line of 3 values to a data frame with three columns, so that each iteration takes on a new row. I've tried using matrix, with ncol=3 and filled by rows, but only get the last item from the loop.
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…