简体   繁体   中英

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:

  • Created the AquaFlux package in RStudio.

  • Thoroughly checked the R package using RStudio package-checking tools. I resolved all errors before uploading the package.

  • I successfully uploaded the package using Github Desktop.

  • Confirmed that "AquaFlux" appears in the Github directory with all of the correct files.

  • Confirmed that files downloaded from the Github repo to my computer's R library. The formatting is different than how they appear in Github, but they are there.

****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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM