I'm using roxygen to create my own package. I have a function that's causing a problem:
##' extract.sig.metadata
##' @param foo bar
##' @author me
##' @export
extract.sig.metadata <- function(foo){
# does stuff
}
I've created my package skeleton (with create(my-package) from devtools), and I've used document() to process the roxygen tags. However, when I try to install my package, it fails:
... * installing help indices ** building package indices ** testing if installed package can be loaded Error : object 'extract' not found whilst loading namespace 'my-package' Error: loading failed Execution halted
I'm pretty sure that roxygen thinks that extract.sig.metadata is an S3 method, i.e. a specialized form of export(), but it's not finding the function export(), and so it's breaking. But this isn't an s3 method, it's just a function called extract.sig.metadata. If I look in the Rd code, the /usage tag looks weird:
\usage{
\method{extract}{sig.metadata}(spec.df, var = "product_name",
ratio.cutoff = 0.001, prob.modifer = 3, frequency.cutoff = NA,
verbose = F, assign.to.global.env = FALSE, use.bigrams = T, clean = T,
ngram.dupe.n.cutoff = 0.1, max.obs = 10000)
}
If I do change the name to extractSigMetadata, the problem is technically fixed, and the .Rd code changes,
\usage{
extractSigMetadata(foo)
}
But I would really like to not have to change the name of my function (there are tens of functions that have the same problem in my package, and they are used in a bunch of scripts - it would be a huge pain to change my naming schema not).
---> Does anyone know how I can tell roxygen that this is just a normal function and not weird s3 method? I'm guessing it has something to do with the @method tag, but I don't know how to use it properly enough to make this work. Thanks!!!
extract
, do you? – Subnormal@export extract.sig.metadata
instead of@export
fixes it! – Roentgen