An R package for the inference of physiologically-based toxicokinetics model
library("rstantools")
rstan_create_package(path = 'rPBK')
See further information here rstantools
Use this to add a new dependency
::use_package("ggplot2")
usethis::use_package("testthat") usethis
Additional dependencies used in the Vignette
::use_package("loo", "Suggests") usethis
Use this to add a data to be used in the package
::use_data(dataCompartment4)
usethis::use_data(dataMaleGammarusSingle) usethis
Use this to add a test function. ADD A TEST FILE TO EVERY NEW R FILE!
::use_test("data.R")
usethis::use_test("dataPBK.R")
usethis::use_test("fitPBK.R")
usethis::use_test("plotFIT.R")
usethis::use_test("plotPPC.R")
usethis::use_test("predictPBK.R") usethis
Add vignette
::use_vignette("Examples") usethis
remove files from building
::use_build_ignore("[.]so", escape = FALSE)
usethis::use_build_ignore("[.]o", escape = FALSE) usethis
Before ‘Documentation’ and ‘Clear and Rebuild’ and within ‘Configure Build Tools…’ untick ‘use devtools package function if available’. Keep ‘Generate Configuration with Roxygen’
devtools::load_all()
To make the package lighter, we have to remove the vignettes: see
file .Rbuildignore
Sometimes, there is an Error to recompile during development after
change of .stan files. A solution is to remove the rPBK
folder in R repository of the win-library (see the path written in the
error message).
An other solution is to build the package from the terminal using
R CMD -preclean INSTALL rPBK
from parent directory of
rPBK
.
xxr
:
usethis::use_package("xxr")
datar
:
usethis::use_data(datar)
example(source) # defines the sourceDir() function
try(roxygen2::roxygenize(load_code = sourceDir), silent = TRUE)
::roxygenize() roxygen2
::compile_dll() # to preform a fake R CMD install
pkgbuild::roxygenize() # to update the documentation
roxygen2::install() devtools
Test and Check the package
::test()
devtools::check() devtools
then to build the package:
::build() devtools
If the archive produce (rPBK_X.Y.Z.tar.gz
) is in the
workspace of the container (outside RPBK), then move the archive:
mv rPBK_X.Y.Z.tar.gz rPBK
Check as CRAN
R CMD check --as-cran
or from command line, but not working very well to be send to CRAN:
R CMD INSTALL --preclean --no-configure --build .
R CMD INSTALL --preclean --build .