0

I'm working on a custom R package, in which I'm using S4 classes and methods. In one of the methods for a custom S4 class in the same file, I'm using the GET() method from the httr package. I tried using roxygen2 to properly set up my NAMESPACE file, having put @importFrom httr GET in the roxygen2 comment of the method and importing the package in the DESCRIPTION file.

#' 
#' @importFrom httr GET
setMethod(f="method_name",
          signature="Class_name",
          definition=function()
          {
            ...
            foo<- GET(url = "bar")
            ...
          }

However, when executing devtools::document(), I'm getting:
Error in method_name() (from file_name.R#198) : could not find function "GET"

What am I missing here?

UPDATE: It seems roxygen2 never properly generates a NAMESPACE file. I deleted the old (outdated) one, but devtools::document() won't create a new one.

jakobus
  • 1
  • 4
  • What do the relevant parts of your DESCRIPTION and NAMESPACE look like after `devtools::document()`? (perhaps include them in your question). – Thomas May 27 '16 at 17:18
  • They actually seem to remain unchanged. There are some imports and exports from a past 'devtools::document()' call, but none of the new imports/exports seems to be recongnized/put into the NAMESPACE file. Maybe I missed some requirements for roxygen2 to properly work. – jakobus May 28 '16 at 14:19
  • Did you `#' @export` the functions? – Thomas May 28 '16 at 15:42
  • Not this one in particular. But my understanding was, that you only `@export`functions you want to be publicly available in your package? The method in question is only internally used (it is the overwritten `initialize` method of one of the S4 classes). – jakobus May 28 '16 at 16:16

0 Answers0