'Why does this loop and append to data frame not work?
I've done a similar operation many times, yet this example has me perplexed. Why does this not work? My expected output is an avg per row of avgs
library(dplyr)
for(i in 1:3) {
avgs = data_frame('avgs' = rep(NA,3))
avg = mean(rnorm(100, .6 , 6.8))
avgs[i, ] = avg
}
avgs
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
