BLE-LTER / BLEdatatools

R package to download and collate BLE LTER data from EDI repository
Other
0 stars 0 forks source link

properly document dependencies, external functions, function exports #32

Open atn38 opened 2 years ago

atn38 commented 2 years ago

Alina ran into some trouble with dependencies on Monday. We should be more carefully document dependencies in a way that would prompt user machines to stall or auto-install packages we depend on upon installation or loading of BLEdatatools. Imo best practices would be:

  1. Prefix any external functions with the double colon syntax, e.g. "readr::read_csv"
  2. Document the packages the external functions come from in the DESCRIPTION file, e.g.
    Imports: 
    readr

A quick way to programmatically edit the DESCRIPTION file is to use usethis::use_package("readr"). If the external package is not on CRAN but Github, e.g. bleutils, use usethis::use_dev_package("bleutils", remotes = "BLE-LTER/bleutils" and the output DESCRIPTION would read:

Imports: 
    bleutils (>= 0.1.0)
Remotes: 
    BLE-LTER/bleutils
  1. Export BLEdatatools functions that we want to be user-facing (so, not the utility-functions) with the @export tag in the header, like so:
    # cool useful metadata up here
    #' @export

See commit 9939337599a7f2923052db10edc4bfd648890f90 for an example of some cleaning up.