-
https://hilaryparker.com/2014/04/29/writing-an-r-package-from-scratch/
-
To add a dependency:
devtools::use_package("packageName")
-
To check package:
devtools::check()
-
To style code:
Tools --> Addins --> Style package --> styler
-
To generate documentation:
devtools::document()
-
To build vignettes:
devtools::build_vignettes()
-
To install package:
devtools::install("../streamDepletr", build_vignettes = T)
-
To check on Windows development/release versions;
devtools::check_win_devel(), devtools::check_win_release()
Goal: common style among all functions within the package. Solution: Use Hadley Wickham's guide http://r-pkgs.had.co.nz/style.html
When calling a function from a different package, make sure to explicitly define the package (e.g. dplyr::summarize).
Most of these functions are introduced in a paper and that is how they are typically referred to in the literature (e.g. the Hunt solution). We will follow that convention for function names.
Use these variable names, which are consistent with the hydrogeological literature:
Qw
= well pumping rate [L3/T] =Qf/Qs
Qf
= capture fraction [-] =Qw/Qs
Qs
= streamflow depletion [L3/T], =Qw*Qf
Qa
= ambient groundwater inflow rate per unit length of stream [L2/T]d
= distance from well to stream [L]S
= aquifer storage coefficient [-] (specific yield for unconfined aquifer, storativity for confined aquifer)Kh
= aquifer horizontal hydraulic conductivity [L/T]Kv
= aquifer vertical hydraulic conductivity [L/T]b
= aquifer saturated thickness [L]Tr
= aquifer transmissivity [L2/T], =Kh*b
t
= time since pumping started [T]Kriv
= riverbed hydraulic conductivity [L/T]briv
= thickness of riverbed semipervious layer [L]w
= stream width [L]beff
= effective transmissivity [L]. Reeves et al. (2009) use the distance from bottom of stream to top of well screenlmda
= streambed conductance [L/T]
- Check on local machine:
devtools::check()
- Check on CRAN win-builder, devel version:
devtools::check_win_devel()
- Check on CRAN win-builder, release version:
devtools::check_win_release()
- Check on R-hub defaults:
devtools::check_rhub()
- Update
cran-comments.md
andNEWS.md
- Release:
devtools::release()