I want to know how to store the values of the complete loop output into a single dataframe in R. For example,
for(i in unique(x$id)){
.
.
.
y=output of one iteration}
At the end of each iteration, I am getting the output in y. But I want to store output of all iterations into y. How do I do that in R?
You can do this simply by
y <- NULL;
for (i in unique(x$id))
{
tmp <- [output of one iteration]
y <- rbind(y, tmp)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With