Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

roxygen Warning: : Missing name

Tags:

roxygen2

So I'm trying to use roxygen2 to document my code. Unfortunately my supervisor felt it was cluttered having so many functions in the global environment. So I've been told to hide them away in sub environments. This seems to be stopping roxygen detecting them correctly. Minimal example below.

my_env <- new.env()

#' test
#' 
#' more test
#' 
#' @return none
my_env$my_func <- function(){}
environment(my_env$my_func) <- my_env

I'm using the Document() command in devtools to build the documentation. However I just keep getting the error "Warning: min_examp.R:8: Missing name". Given I don't think I'm going to be allowed to put the functions back the way they were before hiding them does anyone have any suggestions about how to get roxygen to detect my functions?

like image 341
Peter Clark Avatar asked Jul 10 '18 14:07

Peter Clark


2 Answers

roxygen2 can't find the name of your function.

Provide a name to your function like so

#' @name name_of_your_function
like image 68
stevec Avatar answered Sep 22 '22 18:09

stevec


I was finally able to fix this by doing the following

my_env <- new.env()

#' my title
#' 
#' @name my_env$my_func
#' 
#' @usage my_env$my_func()
#' 
#' more test
#' 
#' @return none
my_env$my_func <- function(){}
environment(my_env$my_func) <- my_env
like image 31
Peter Clark Avatar answered Sep 23 '22 18:09

Peter Clark