Message-ID: <CAN5afy9QKtxJQyCxtcGXOL=vPCX0PDMreG=sjRF2GggrL8GhCQ@mail.gmail.com>
Date: 2017-01-06T18:00:30Z
From: lily li
Subject: About populating a dataframe in a loop
Hi R users,
I have a question about filling a dataframe in R using a for loop.
I created an empty dataframe first and then filled it, using the code:
pre.mat = data.frame()
for(i in 1:10){
mat.temp = data.frame(some values filled in)
pre.mat = rbind(pre.mat, mat.temp)
}
However, the resulted dataframe has not all the rows that I desired for.
What is the problem and how to solve it? Thanks.
[[alternative HTML version deleted]]