roxygen Warning: : Missing name
Asked Answered
A

3

11

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?

Alvinaalvine answered 10/7, 2018 at 14:43 Comment(0)
D
6

roxygen2 can't find the name of your function.

Provide a name to your function like so

#' @name name_of_your_function
Devolution answered 10/3, 2019 at 14:30 Comment(0)
A
3

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
Alvinaalvine answered 11/7, 2018 at 12:50 Comment(0)
C
-1

I was able to fix the issue by testing if all functions in the R folder can be run without error. Any buggy functions related to your "min_examp.R" are likely to generate the MISSING NAME error.

Candlewick answered 15/8, 2019 at 20:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.