Search code examples
rcross-validationglm

Why is it `sample0` not `sample` inside `cv.glm`?


I am going through the source code for cv.glm from boot. There is one line

s <- sample0(rep(1L:K, f), n)

I looked up sample0, but it doesn't exist. I believe it really means sample(). Why is it entered as sample0 here?


Solution

  • Have a look at:

    boot:::sample0
    #function (x, ...) 
    #x[sample.int(length(x), ...)]
    #<bytecode: 0xa2a30e4>
    #<environment: namespace:boot>
    

    This is an internal / non-exported function in the namespace of boot.