HSpeckman
HSpeckman

Reputation: 51

R package downloaded from Github missing functions

I am publishing an R package to GitHub (EwersLabUWyo/AquaFlux). The upload to Github appears to have worked. In a fresh instance of RStudio, I successfully downloaded the package to check it, but none of the functions appear in R.

 devtools::install_github("EwersLabUWyo/AquaFlux")
 library(AquaFlux)
 AquaFlux::AquaFlux()
 Error: could not find function "AquaFlux"

Process/check thus far:

****Update responding to comments****

During the developmental process, I tried to use roxygen2 to help with package building, but it didn't seem to work, so I quit messing with it several weeks ago. The NAMESPACE file is blank, and says "do not edit by hand".

I did go and update the DESCRIPTION file to include "Exports: AquaFlux.Rd", but it's still not working.

I can confirm that all of the files match between my local copy and the online git repo.

Upvotes: 2

Views: 498

Answers (1)

Justin Landis
Justin Landis

Reputation: 2071

I just took a look at your github. It seems that you are using roxygen2 but have not yet used the special tags to document your functions. Please have a look at the introduction to roxygen2 but more specifically managing NAMESPACE.

I believe you are looking for

#' @export
AquaFlux <- function() {
  shiny::shinyApp(.AquaFlux.ui, .AquaFlux.server)
}

in your AquaFlux_master.R file. This export tag makes it so Roxygen writes this function in the namespace which allows the user to call the funciton. All functions that do not have the export tag are considered internal functions only to be called by the package and never the user.

Also make sure your project is configured to generate documentation with Roxygen in the build settings.

Upvotes: 1

Related Questions