I have written a small package for my own use, and using devtools everything has gone very well. However, I tried to run R CMD Check on it, and got a number of errors, seemingly because my usage and examples use functions from base R that aren't in my package, for instance here's my minimal function, and roxygen documentation
#' Function to Sort a dataframe with a given list of columns
#' Cribbed from Spector, P. (2008). "Data Manipulation with R", UseR! Springer. Pg78
#' @param df Dataframe to be sorted
#' @param ... list of columns to sort on
#' @return A sorted dataframe
#' @author "Paul Hurley"
#' @export
#' @usage with(dataframe,sortframe(dataframe,column1, column2, column3))
#' @examples with(iris,sortframe(iris,Sepal.Length,Sepal.Width,Petal.Length))
sortframe<-function(df,...){df[do.call(order,list(...)),]}
and R CMD Check gives
Undocumented arguments in documentation object 'sortframe'
'dataframe' 'sortframe(dataframe, column1, column2, column3)'
Documented arguments not in \usage in documentation object 'sortframe':
'df' '...'
Objects in \usage without \alias in documentation object 'sortframe':
'with'
Is there a way to tell R CMD Check / roxygen2 that these functions are described in base ?
You shouldn't include a @usage
tag. Roxygen will infer it from your code. your @usage
is really an example. R is complaining because you are referring to objects that aren't in your function definition at all. @usage
, if you insist on putting it in yourself, should only reference sortframe
, df
, and ...
. Since you already have an @example
, you should be able to omit the @usage
tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With