Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R package build Undocumented code objects

Tags:

I have written an R package for integrating with electronic medical records. I think I have correctly added the imports and dependencies in the DESCRIPTION file and documented everything via roxygen2, but on three of my functions (which are all in the same file) I get this warning when I run devtools::check("."):

* checking for missing documentation entries ... WARNING
Undocumented code objects:
  'add_to_database' 'database' 'import_CPRD_data'
All user-level objects in a package should have documentation entries. 

I think I have documented these in the same way as all of my other functions which are fine. Here is one of the offending functions with the roxygen2 documentation:

#' Wrapper for dbconnect
#' 
#' Connects to a SQLite database or creates one if it does not already exist
#' 
#' If the '.sqlite' file extension is ommited from the dbname argument it is automatically added.
#'
#' @export
#' 
#' @param dbname character name path to database file
#' @return SQLiteConnection object
#' @examples \dontrun{
#' db <- database("mydb")
#' }
database <- function(dbname){
    if(!str_detect(dbname, "\\.sqlite$")) {
        dbname <- paste(dbname, "sqlite", sep = ".")
    } 
    dbConnect(SQLite(), dbname)
}

How can I get rid of this error? I have added stringr and RSQLite to the depends section of the DESCRIPTION file and they show up in NAMESPACE, so I don't think this is an import problem - but then what am I failing to document? The full package is here and the file with the file with the offending functions is here. I have looked in the writing R extensions manual and can't find the problem - don't know if I am just going blind from looking - but I can't see what I am doing differently in these functions from the others I have written!

like image 554
dspringate Avatar asked Jun 26 '14 15:06

dspringate


Video Answer


1 Answers

You use roxygen, but most likely you don't roxygenize your package on build.

Either call:

roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))

or, if you use RStudio, edit Project Options (Tools menu) and in the Build Tools tab check Generate documentation with Roxygen.

like image 62
gagolews Avatar answered Sep 17 '22 15:09

gagolews