0

Whilst running the roxygenize() command from the roxygen2 package in R, I get the message:

Error in get(fun, mode = "function", envir = parent.frame()) : 
  object '22' of mode 'function' was not found

Any ideas how to debug this message would be appreciated. I've tried grepping my package for '22', but nothing relevant comes up. Traceback is also unhelpful (gives traceback through roxygen2 functions rather than my package):

6: get(fun, mode = "function", envir = parent.frame())
5: formals(partitum$object$value)
4: roclet_rd_one(partitum, base_path)
3: roc_process.had(roc, parsed, base_path, options = options)
2: roc_process(roc, parsed, base_path, options = options)
1: roxygenize("myPackage")

Any advice greatly appreciated - thanks.

Dave Slanted
  • 145
  • 1
  • 5
  • Without access to the package (github etc) this is difficult. I've pulled out half of the functions at a time and roxygenized and added or subtracted halves until I find the function who offends, then look for some silly thing you over looked somewhere. – Tyler Rinker Feb 02 '14 at 01:19
  • See my answer. You can document variables, you just need to do things a bit differently. – jamie.f.olson Feb 10 '14 at 20:44

2 Answers2

0

Found the problem - I had roxygen documentation on a couple of variables (not functions). I removed the documentation against the variables at it worked (I only had two).

Documenting variables was working for me in the past but I think it was probably broken since updating to roxygen 3.0.0. I'll report it to the maintainer, see what they make of it. Thanks!

Dave Slanted
  • 145
  • 1
  • 5
0

I ran up against this error, as well. The problem is that roxygen doesn't expect your data documentation to appear with your data definition. If you provide a non-NULL value, roxygen treats it like a function to be documented.

Instead of:

#' Data title
#' 
#' More information
#' 
#' @docType data
#' @format A data frame with some rows and some variables
my_data <- data.frame(x=rnorm(100),y=rexp(100))

You need this:

#' Data title
#' 
#' More information
#' 
#' @docType data
#' @format A data frame with some rows and some variables
#' @name my_data
NULL
my_data <- data.frame(x=rnorm(100),y=rexp(100))
jamie.f.olson
  • 982
  • 1
  • 8
  • 15