Movatterモバイル変換


[0]ホーム

URL:


rPBK

An R package for the inference of physiologically-basedtoxicokinetics model

Dev R

Package skeleton

library("rstantools")rstan_create_package(path ='rPBK')

See further information hererstantools

Dev info

Use this to add a new dependency

usethis::use_package("ggplot2")usethis::use_package("testthat")

Additional dependencies used in the Vignette

usethis::use_package("loo","Suggests")

Use this to add a data to be used in the package

usethis::use_data(dataCompartment4)usethis::use_data(dataMaleGammarusSingle)

Use this to add a test function. ADD A TEST FILE TO EVERY NEW RFILE!

usethis::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")

Add vignette

usethis::use_vignette("Examples")

remove files from building

usethis::use_build_ignore("[.]so",escape =FALSE)usethis::use_build_ignore("[.]o",escape =FALSE)

Rstudio

Before ‘Documentation’ and ‘Clear and Rebuild’ and within ‘ConfigureBuild Tools…’ untick ‘use devtools package function if available’. Keep‘Generate Configuration with Roxygen’

little hack

A lighter package build

To make the package lighter, we have to remove the vignettes: seefile.Rbuildignore

Error to recompile duringpackage dev

Sometimes, there is an Error to recompile during development afterchange of .stan files. A solution is to remove therPBKfolder in R repository of the win-library (see the path written in theerror message).

An other solution is to build the package from the terminal usingR CMD -preclean INSTALL rPBK from parent directory ofrPBK.

Dev tools

Dev In Docker

Roxygen for thedocumentation

example(source)# defines the sourceDir() functiontry(roxygen2::roxygenize(load_code = sourceDir),silent =TRUE)roxygen2::roxygenize()

Build

pkgbuild::compile_dll()# to preform a fake R CMD installroxygen2::roxygenize()# to update the documentationdevtools::install()

Test and Check the package

devtools::test()devtools::check()

then to build the package:

 devtools::build()

If the archive produce (rPBK_X.Y.Z.tar.gz) is in theworkspace 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 toCRAN:

R CMD INSTALL --preclean --no-configure --build .R CMD INSTALL --preclean --build .

[8]ページ先頭

©2009-2025 Movatter.jp