2

Sometimes I see functions with occult functions. If you call these functions, R does not recognized them and throws an Error.

I was reading the code for xgb.cv function from xgboost R package and realized that they use a function (generate.cv.folds) and it seems that it is not "available". So I was wondering how they do it, and if is that possible to access this specific function. The error message is the following:

#Error: object 'generate.cv.folds' not found

Thank you.

patL
  • 2,259
  • 1
  • 17
  • 38
  • 3
    Access it using `xgboost:::generate.cv.folds`. A function like this is not exported, i.e. the package dev does not want you to use it in the first place, so be careful. –  Nov 08 '17 at 10:45
  • Thank you. And how you occult it when writing in your function? – patL Nov 08 '17 at 10:46
  • 2
    I guess with *occult* you mean private or so? If a developers writes a package and does not `#' @export` a function, then the user (you) does not see it. –  Nov 08 '17 at 10:48
  • Perfect explanation!! Thank you @SimonDirmeier. – patL Nov 08 '17 at 10:50
  • 1
    Marked as duplicate. See the excellent answers in the original link for a full in-depth explanation of how to access to functions and methods in R. – nicola Nov 08 '17 at 11:08
  • Thanx @nicola. I did now that post, but I miss the "Unexported functions" part. – patL Nov 08 '17 at 12:21

0 Answers0