Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201894

How do I use sample function for bootstrapping in R? Replacement row problem

$
0
0

I am trying to create a bootstrap for the data frame 'ev_all_clean'

set.seed(1315)
boot_s <- as.data.frame(matrix(NA, ncol = 19, nrow = 1000))
for(k in 1:19){
  for(l in 1:1000){
  boot_s[l,k]<- sample(ev_all_clean[,k], size=1, replace=T)
  }
}

The above code returns

replacement element 1 has 768 rows to replace 1 rows

Help is much appreciated! Thank you in advance.


Viewing all articles
Browse latest Browse all 201894

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>