Re: [R] Vectorizing a for-loop for cross-validation in R

2019-01-23 Thread Aleksandre Gavashelishvili
; > > > > On Wed, Jan 23, 2019 at 8:34 PM Berry, Charles wrote: > >> See inline. >> >> > On Jan 23, 2019, at 2:17 AM, Aleksandre Gavashelishvili < >> aleksandre.gavashelishv...@iliauni.edu.ge> wrote: >> > >> > I'm trying to spe

[R] Vectorizing a for-loop for cross-validation in R

2019-01-23 Thread Aleksandre Gavashelishvili
I'm trying to speed up a script that otherwise takes days to handle larger data sets. So, is there a way to completely vectorize or paralellize the following script: *# k-fold cross validation* df <- trees # a data frame 'trees' from R. df <- df[sample(nrow(df)), ] # randomly shuf