Title: | Supplementary Tools for R Packages Developers |
---|---|
Description: | Supplementary utils for CRAN maintainers and R packages developers. Validating the library, packages and lock files. Exploring a complexity of a specific package like evaluating its size in bytes with all dependencies. The shiny app complexity could be explored too. Assessing the life duration of a specific package version. Checking a CRAN package check page status for any errors and warnings. Retrieving a DESCRIPTION or NAMESPACE file for any package version. Comparing DESCRIPTION or NAMESPACE files between different package versions. Getting a list of all releases for a specific package. The Bioconductor is partly supported. |
Authors: | Maciej Nasinski [aut, cre] |
Maintainer: | Maciej Nasinski <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.6.0 |
Built: | 2024-10-27 06:21:16 UTC |
Source: | https://github.com/polkas/pacs |
the shiny app dependencies packages are checked recursively.
The c("Depends", "Imports", "LinkingTo")
DESCRIPTION files fields are checked recursively.
The required dependencies have to be installed in the local repository.
The default arguments setup is recommended.
app_deps( path = ".", fields = c("Depends", "Imports", "LinkingTo"), lib.loc = .libPaths(), local = TRUE, base = FALSE, description_v = FALSE, recursive = TRUE, repos = biocran_repos() )
app_deps( path = ".", fields = c("Depends", "Imports", "LinkingTo"), lib.loc = .libPaths(), local = TRUE, base = FALSE, description_v = FALSE, recursive = TRUE, repos = biocran_repos() )
path |
|
fields |
|
lib.loc |
|
local |
|
base |
|
description_v |
|
recursive |
|
repos |
|
character
vector with dependency packages or data.frame when checking recursively.
renv
package has to be installed.
## Not run: library(renv) # Please update the path to the custom shiny app app_path <- system.file("examples/04_mpg", package = "shiny") pacs::app_deps(app_path) pacs::app_deps(app_path, recursive = FALSE) ## End(Not run)
## Not run: library(renv) # Please update the path to the custom shiny app app_path <- system.file("examples/04_mpg", package = "shiny") pacs::app_deps(app_path) pacs::app_deps(app_path, recursive = FALSE) ## End(Not run)
The size of shiny app is a sum of dependencies packages and the app directory. The app dependencies packages are checked recursively, and only in local repository. The default arguments setup is recommended.
app_size( path = ".", fields = c("Depends", "Imports", "LinkingTo"), lib.loc = .libPaths(), recursive = TRUE )
app_size( path = ".", fields = c("Depends", "Imports", "LinkingTo"), lib.loc = .libPaths(), recursive = TRUE )
path |
|
fields |
|
lib.loc |
|
recursive |
|
numeric
size in bytes, to get MB ten divide by 10**6
.
renv
package has to be installed. base
packages (pacs::pacs_base()
) are not taken into account.
## Not run: library(renv) # Please update the path to the shiny app cat(pacs::app_size(system.file("examples/04_mpg", package = "shiny")) / 10**6, "MB") ## End(Not run)
## Not run: library(renv) # Please update the path to the shiny app cat(pacs::app_size(system.file("examples/04_mpg", package = "shiny")) / 10**6, "MB") ## End(Not run)
Retrieving all Bioconductor releases.
The data is downloaded from https://www.bioconductor.org/about/release-announcements/
.
bio_releases()
bio_releases()
data.frame
with the same structure as the html table on https://www.bioconductor.org/about/release-announcements/
.
Results are cached for 30 minutes with memoise
package.
## Not run: pacs::bio_releases() ## End(Not run)
## Not run: pacs::bio_releases() ## End(Not run)
CRAN and Bioconductor repositories. The newest Bioconductor release for the specific R version is assumed.
biocran_repos(version = NULL)
biocran_repos(version = NULL)
version |
|
named character
vector of repositories.
The Internet connection is needed to get Bioconductor repositories.
## Not run: pacs::biocran_repos() ## End(Not run)
## Not run: pacs::biocran_repos() ## End(Not run)
Retrieving all R CRAN packages check pages statuses.
The data is downloaded from https://cran.r-project.org/web/checks/check_summary_by_package.html
.
checked_packages()
checked_packages()
data.frame
with the same structure as the html table on https://cran.r-project.org/web/checks/check_summary_by_package.html
.
Results are cached for 30 minutes with memoise
package.
Some packages could be duplicated as not all tests are performed for a new version so two versions still coexists.
Checks with asterisks (*) indicate that checking was not fully performed, this is a case for less than 1% of all packages.
## Not run: pacs::checked_packages() ## End(Not run)
## Not run: pacs::checked_packages() ## End(Not run)
Reduce function over the utils::compareVersion
compareVersionsMax(vec, na.rm = TRUE)
compareVersionsMax(vec, na.rm = TRUE)
vec |
|
na.rm |
|
character
maximum version
compareVersionsMax(c("1.1.1", "0.2.0"))
compareVersionsMax(c("1.1.1", "0.2.0"))
Reduce function over the utils::compareVersion
compareVersionsMin(vec, na.rm = TRUE)
compareVersionsMin(vec, na.rm = TRUE)
vec |
|
na.rm |
|
character
minimal version
compareVersionsMin(c("1.1.1", "0.2.0"))
compareVersionsMin(c("1.1.1", "0.2.0"))
Retrieving all R CRAN servers flavors.
The data is downloaded from https://cran.r-project.org/web/checks/check_flavors.html
.
cran_flavors()
cran_flavors()
data.frame
with the same structure as the html table on https://cran.r-project.org/web/checks/check_flavors.html
.
Results are cached for 30 minutes with memoise
package.
## Not run: pacs::cran_flavors() ## End(Not run)
## Not run: pacs::cran_flavors() ## End(Not run)
size of package.
dir_size(path = ".", recursive = TRUE)
dir_size(path = ".", recursive = TRUE)
path |
|
recursive |
|
numeric
size in bytes, to get MB ten divide by 10**6
.
## Not run: cat(pacs::dir_size(system.file(package = "stats")) / 10**6, "MB") ## End(Not run)
## Not run: cat(pacs::dir_size(system.file(package = "stats")) / 10**6, "MB") ## End(Not run)
Checking if installed packages have correct versions taking into account all DESCRIPTION files requirements. Moreover identifying which packages are newest releases. Optionally we could add life duration and CRAN check page status for each package.
lib_validate( lib.loc = .libPaths(), fields = c("Depends", "Imports", "LinkingTo"), lifeduration = FALSE, checkred = list(scope = character(0), flavors = NULL), built = FALSE, repos = biocran_repos() )
lib_validate( lib.loc = .libPaths(), fields = c("Depends", "Imports", "LinkingTo"), lifeduration = FALSE, checkred = list(scope = character(0), flavors = NULL), built = FALSE, repos = biocran_repos() )
lib.loc |
|
fields |
|
lifeduration |
|
checkred |
|
built |
|
repos |
|
data.frame
with 4/6/8/9/10 columns.
character a package name.
character expected by DESCRIPTION files minimal version. "" means not specified so the newest version.
character installed package version.
numeric -1/0/1 which comes from utils::compareVersion
function.
0 means that we have the same version as required by DESCRIPTION files. -1 means we have too low version installed, this is an error. 1 means we have higher version.
character package was built under this R version
integer if the package was built under the current R version, then 1 (good) and for older R versions 0 (possibly bad). A package built under older R version or mix of packages built under different versions could bring possible failures.
logical (Internet needed) if the installed version is the newest one. For Bioconductor if is the newest one per R version.
logical (Internet needed) if the package is on CRAN, version is not taken into account here.
(Optional) (Internet needed) logical if the NEWEST package contains any specified statuses on CRAN check page. pacs::checked_packages
is used to quickly retrieve all statuses at once.
(Optional) (Internet needed) integer number of days a package was released.
Version.expected.min column not count packages which are not a dependency for any package, so could not be find in DESCRIPTION files.
When turn on the lifeduration
options, calculations might be time consuming for libraries bigger than 500 packages.
Results are cached for 30 minutes with memoise
package.
BioConductor
packages are tested only in available scope, checkred
is not assessed for them.
The crandb
R packages database is a part of METACRAN
project, source:
Csárdi G, Salmon M (2022). pkgsearch
: Search and Query CRAN R Packages. https://github.com/r-hub/pkgsearch
, https://r-hub.github.io/pkgsearch/
.
## Not run: pacs::lib_validate() pacs::lib_validate(checkred = list(scope = c("ERROR", "FAIL", "WARN"))) pacs::lib_validate(checkred = list( scope = c("ERROR", "FAIL"), flavors = pacs::match_flavors() )) # activate lifeduration argument, could be time consuming for bigger libraries. pacs::lib_validate( lifeduration = TRUE, checkred = list(scope = c("ERROR", "FAIL")) ) # only R CRAN repository pacs::lib_validate(repos = "https://cran.rstudio.com/") ## End(Not run)
## Not run: pacs::lib_validate() pacs::lib_validate(checkred = list(scope = c("ERROR", "FAIL", "WARN"))) pacs::lib_validate(checkred = list( scope = c("ERROR", "FAIL"), flavors = pacs::match_flavors() )) # activate lifeduration argument, could be time consuming for bigger libraries. pacs::lib_validate( lifeduration = TRUE, checkred = list(scope = c("ERROR", "FAIL")) ) # only R CRAN repository pacs::lib_validate(repos = "https://cran.rstudio.com/") ## End(Not run)
This function will be especially useful when renv lock file is built manually.
Checking if packages in the lock file have correct versions taking into account their DESCRIPTION files requirements (c("Depends", "Imports", "LinkingTo")
).
Moreover identifying which packages are newest releases.
Optionally we could add life duration and CRAN check page status for each dependency.
lock_validate( path, lifeduration = FALSE, checkred = list(scope = character(0), flavors = NULL), lib.loc = .libPaths(), repos = biocran_repos() )
lock_validate( path, lifeduration = FALSE, checkred = list(scope = character(0), flavors = NULL), lib.loc = .libPaths(), repos = biocran_repos() )
path |
|
lifeduration |
|
checkred |
|
lib.loc |
|
repos |
|
data.frame
with 2/6/7/8 columns.
character a package name.
(conditional) (Internet needed) character expected by DESCRIPTION files minimal version. "" means not specified so the newest version.
character package version in the renv lock file.
(conditional) numeric -1/0/1 which comes from utils::compareVersion
function.
0 means that we have the same version as required by DESCRIPTION files. -1 means we have too low version installed, this is an error. 1 means we have higher version.
logical (Internet needed) if the installed version is the newest one.
logical (Internet needed) if the package is on CRAN, version is not taken into account here.
(Optional) (Internet needed) logical if the NEWEST package contains any specified statuses on CRAN check page.
(Optional) (Internet needed) integer number of days a package was released.
Version.expected.min column not count packages which are not a dependency for any package, so could not be find in DESCRIPTION files.
Version.expected.min
and version_status
are assessed only if there are less than 500 packages in the lock file.
When turn on the lifeduration
option, calculations might be time consuming when there is more than 500 packages.
The crandb
R packages database is a part of METACRAN
project, source:
Csárdi G, Salmon M (2022). pkgsearch
: Search and Query CRAN R Packages. https://github.com/r-hub/pkgsearch
, https://r-hub.github.io/pkgsearch/
.
## Not run: # path or url url <- "https://raw.githubusercontent.com/Polkas/pacs/master/tests/testthat/files/renv_test.lock" pacs::lock_validate(url) pacs::lock_validate( url, checkred = list(scope = c("ERROR", "FAIL"), flavors = pacs::match_flavors()) ) pacs::lock_validate( url, lifeduration = TRUE, checkred = list(scope = c("ERROR", "FAIL"), flavors = NULL) ) ## End(Not run)
## Not run: # path or url url <- "https://raw.githubusercontent.com/Polkas/pacs/master/tests/testthat/files/renv_test.lock" pacs::lock_validate(url) pacs::lock_validate( url, checkred = list(scope = c("ERROR", "FAIL"), flavors = pacs::match_flavors()) ) pacs::lock_validate( url, lifeduration = TRUE, checkred = list(scope = c("ERROR", "FAIL"), flavors = NULL) ) ## End(Not run)
OS
CRAN servers matched to the local OS
.
match_flavors()
match_flavors()
character
vector matched server names.
The Internet connection is needed to use the function.
## Not run: pacs::match_flavors() ## End(Not run)
## Not run: pacs::match_flavors() ## End(Not run)
Retrieving the R CRAN package check page.
pac_checkpage(pac)
pac_checkpage(pac)
pac |
|
data.frame
.
Results are cached for 30 minutes with memoise
package.
If you need to check many packages at once then is recommended usage of pacs::checked_packages
.
Please as a courtesy to the R CRAN, don't overload their server by constantly using this function.
## Not run: pacs::pac_checkpage("dplyr") ## End(Not run)
## Not run: pacs::pac_checkpage("dplyr") ## End(Not run)
using package R CRAN check page to validate if there are ANY errors and/or fails and/or warnings and/or notes.
pac_checkred(pac, scope = c("ERROR", "FAIL"), flavors = NULL)
pac_checkred(pac, scope = c("ERROR", "FAIL"), flavors = NULL)
pac |
|
scope |
|
flavors |
|
logical
if the package fail under specified criteria.
Results are cached for 30 minutes with memoise
package.
If you need to check many packages at once then is recommended usage of pacs::checked_packages
.
The used repository https://cran.rstudio.com/
.
Please as a courtesy to the R CRAN, don't overload their server by constantly using this function.
## Not run: pacs::pac_checkred("dplyr") pacs::pac_checkred("dplyr", scope = c("ERROR")) pacs::pac_checkred("dplyr", scope = c("ERROR", "FAIL", "WARN"), flavors = pacs::match_flavors() ) ## End(Not run)
## Not run: pacs::pac_checkred("dplyr") pacs::pac_checkred("dplyr", scope = c("ERROR")) pacs::pac_checkred("dplyr", scope = c("ERROR", "FAIL", "WARN"), flavors = pacs::match_flavors() ) ## End(Not run)
using the remote github CRAN mirror to compare NAMESPACE exports between specific packages versions.
pac_compare_namespace( pac, old = NULL, new = NULL, lib.loc = .libPaths(), repos = "https://cran.rstudio.com/" )
pac_compare_namespace( pac, old = NULL, new = NULL, lib.loc = .libPaths(), repos = "https://cran.rstudio.com/" )
pac |
|
old |
|
new |
|
lib.loc |
|
repos |
|
list
with c("imports", "exports", "exportPatterns", "importClasses", "importMethods", "exportClasses", "exportMethods", "exportClassPatterns", "dynlibs", "S3methods")
slots, and added and removed ones for each of them.
## Not run: pacs::pac_compare_namespace("shiny", "1.0.0", "1.6.0") pacs::pac_compare_namespace("shiny", "1.0.0", "1.6.0")$exports # local version to newest one pacs::pac_compare_namespace("shiny") ## End(Not run)
## Not run: pacs::pac_compare_namespace("shiny", "1.0.0", "1.6.0") pacs::pac_compare_namespace("shiny", "1.0.0", "1.6.0")$exports # local version to newest one pacs::pac_compare_namespace("shiny") ## End(Not run)
using the remote github CRAN mirror to compare NEWS files between specific packages versions.
pac_compare_news( pac, old = NULL, new = NULL, lib.loc = .libPaths(), repos = "https://cran.rstudio.com/" )
pac_compare_news( pac, old = NULL, new = NULL, lib.loc = .libPaths(), repos = "https://cran.rstudio.com/" )
pac |
|
old |
|
new |
|
lib.loc |
|
repos |
|
character
with NEWS content between specific versions.
## Not run: pacs::pac_compare_news("shiny", "1.0.0", "1.6.0") # local version to newest one pacs::pac_compare_news("shiny") ## End(Not run)
## Not run: pacs::pac_compare_news("shiny", "1.0.0", "1.6.0") # local version to newest one pacs::pac_compare_news("shiny") ## End(Not run)
using the remote github CRAN mirror to compare DESCRIPTION files dependencies between specific packages versions.
pac_compare_versions( pac, old = NULL, new = NULL, fields = c("Imports", "Depends", "LinkingTo"), lib.loc = .libPaths(), repos = "https://cran.rstudio.com/" )
pac_compare_versions( pac, old = NULL, new = NULL, fields = c("Imports", "Depends", "LinkingTo"), lib.loc = .libPaths(), repos = "https://cran.rstudio.com/" )
pac |
|
old |
|
new |
|
fields |
|
lib.loc |
|
repos |
|
data.frame
with 4 columns.
character package names.
character versions of dependencies required by an old package version.
character versions of dependencies required by a new package version.
numeric -1/0/1 which comes from utils::compareVersion
function.
0 means that both versions have the same requirement. -1 means that the new version remove this requirement. 1 means that the new version added a new requirement.
## Not run: pacs::pac_compare_versions("memoise", "0.2.1", "2.0.0") pacs::pac_compare_versions("memoise", "0.2.1") # local version to newest one pacs::pac_compare_versions("memoise") ## End(Not run)
## Not run: pacs::pac_compare_versions("memoise", "0.2.1", "2.0.0") pacs::pac_compare_versions("memoise", "0.2.1") # local version to newest one pacs::pac_compare_versions("memoise") ## End(Not run)
Package dependencies from DESCRIPTION files with installed or expected versions or newest released.
pac_deps( pac, fields = c("Depends", "Imports", "LinkingTo"), lib.loc = .libPaths(), base = FALSE, local = TRUE, description_v = FALSE, attr = TRUE, recursive = TRUE, repos = biocran_repos() )
pac_deps( pac, fields = c("Depends", "Imports", "LinkingTo"), lib.loc = .libPaths(), base = FALSE, local = TRUE, description_v = FALSE, attr = TRUE, recursive = TRUE, repos = biocran_repos() )
pac |
|
fields |
|
lib.loc |
|
base |
|
local |
logical if to use local repository (or newest remote packages). Default: TRUE |
description_v |
|
attr |
|
recursive |
|
repos |
|
data.frame
with packages and their versions. Versions are taken from installed.packages
or newest released.
When function is invoked in the loop afterwards results could be aggregated like,
stats::aggregate(results[, c("Version"), drop = FALSE], list(Package = results$Package), pacs::compareVersionsMax)
.
## Not run: pacs::pac_deps("stats", base = TRUE)$Package pacs::pac_deps("memoise")$Package pacs::pac_deps("memoise", description_v = FALSE) # raw dependencies from DESCRIPTION file pacs::pac_deps("memoise", description_v = TRUE, recursive = FALSE) # raw dependencies from DESCRIPTION file - last release pacs::pac_deps("memoise", description_v = TRUE, local = FALSE, recursive = FALSE) ## End(Not run)
## Not run: pacs::pac_deps("stats", base = TRUE)$Package pacs::pac_deps("memoise")$Package pacs::pac_deps("memoise", description_v = FALSE) # raw dependencies from DESCRIPTION file pacs::pac_deps("memoise", description_v = TRUE, recursive = FALSE) # raw dependencies from DESCRIPTION file - last release pacs::pac_deps("memoise", description_v = TRUE, local = FALSE, recursive = FALSE) ## End(Not run)
A higher-level function, build from pacs::pacs_deps
.
Package dependencies installed when e.g. R CMD check
a package.
"Depends", "Imports", "LinkingTo", "Suggests"
fields from the DESCRIPTION file and
their recursive dependencies taken from "Depends", "Imports", "LinkingTo"
fields.
Dependencies are taken remotely for the newest version.
pac_deps_dev( pac, base = FALSE, local = FALSE, attr = TRUE, repos = pacs::biocran_repos() )
pac_deps_dev( pac, base = FALSE, local = FALSE, attr = TRUE, repos = pacs::biocran_repos() )
pac |
|
base |
|
local |
|
attr |
|
repos |
|
data.frame
with packages and their versions. Versions are taken from installed.packages
or newest released.
## Not run: pacs::pac_deps_dev("dplyr") pacs::pac_deps_dev("pacs") # with the main package in the list pacs::pac_deps_dev("pacs", attr = FALSE) ## End(Not run)
## Not run: pacs::pac_deps_dev("dplyr") pacs::pac_deps_dev("pacs") # with the main package in the list pacs::pac_deps_dev("pacs", attr = FALSE) ## End(Not run)
A higher-level function, build from pacs::pacs_deps
and tools::package_dependencies
.
A tool to identify a main sources of dependencies, which direct dependencies are the heaviest one.
pac_deps_heavy( pac, fields = c("Depends", "Imports", "LinkingTo"), lib.loc = .libPaths(), base = FALSE, local = FALSE, repos = pacs::biocran_repos() )
pac_deps_heavy( pac, fields = c("Depends", "Imports", "LinkingTo"), lib.loc = .libPaths(), base = FALSE, local = FALSE, repos = pacs::biocran_repos() )
pac |
|
fields |
|
lib.loc |
|
base |
|
local |
|
repos |
|
data.frame
with three columns c("Package", "NrDeps", "NrUniqueDeps")
: package name, number of dependencies and number of unique dependencies (not shared by other direct dependencies).
Please take into account that the sum of the dependencies is not equal to the number of dependencies of the main package, because some dependencies are overlapping.
## Not run: pacs::pac_deps_heavy("caret") pacs::pac_deps_heavy("dplyr") ## End(Not run)
## Not run: pacs::pac_deps_heavy("caret") pacs::pac_deps_heavy("dplyr") ## End(Not run)
Package dependencies from DESCRIPTION files retrieved recursively for certain version or time point.
pac_deps_timemachine( pac, version = NULL, at = NULL, fields = c("Depends", "Imports", "LinkingTo"), recursive = TRUE )
pac_deps_timemachine( pac, version = NULL, at = NULL, fields = c("Depends", "Imports", "LinkingTo"), recursive = TRUE )
pac |
|
version |
|
at |
|
fields |
|
recursive |
|
named vector
package dependencies and their versions at the release date of main package plus one day.
Longer lived version is taken if 2 is available at the same date (switch time).
## Not run: pacs::pac_deps_timemachine("memoise", "0.2.1") pacs::pac_deps_timemachine("memoise", at = as.Date("2019-01-01")) pacs::pac_deps_timemachine("dplyr", at = as.Date("2015-01-01")) ## End(Not run)
## Not run: pacs::pac_deps_timemachine("memoise", "0.2.1") pacs::pac_deps_timemachine("memoise", at = as.Date("2019-01-01")) pacs::pac_deps_timemachine("dplyr", at = as.Date("2015-01-01")) ## End(Not run)
A higher-level function, build from pacs::pacs_deps
.
Package dependencies installed when run installed.packages
.
"Depends", "Imports", "LinkingTo"
fields from the DESCRIPTION file and
their recursive dependencies taken from the same fields.
Dependencies are taken remotely for the newest version.
pac_deps_user( pac, base = FALSE, local = FALSE, attr = TRUE, repos = pacs::biocran_repos() )
pac_deps_user( pac, base = FALSE, local = FALSE, attr = TRUE, repos = pacs::biocran_repos() )
pac |
|
base |
|
local |
|
attr |
|
repos |
|
data.frame
with packages and their versions. Versions are taken from installed.packages
or newest released.
## Not run: pacs::pac_deps_user("dplyr") pacs::pac_deps_user("pacs") # with the main package in the list pacs::pac_deps_user("pacs", attr = FALSE) ## End(Not run)
## Not run: pacs::pac_deps_user("dplyr") pacs::pac_deps_user("pacs") # with the main package in the list pacs::pac_deps_user("pacs", attr = FALSE) ## End(Not run)
CRAN package DESCRIPTION file taken locally or remotely from GITHUB CRAN mirror or CRAN website. By default works for the newest package version.
pac_description( pac, version = NULL, at = NULL, local = FALSE, lib.loc = .libPaths(), repos = "https://cran.rstudio.com/" )
pac_description( pac, version = NULL, at = NULL, local = FALSE, lib.loc = .libPaths(), repos = "https://cran.rstudio.com/" )
pac |
|
version |
|
at |
|
local |
|
lib.loc |
|
repos |
|
list
with names proper for DESCRIPTION file fields.
Results are cached for 30 minutes with memoise
package.
## Not run: pacs::pac_description("dplyr", version = "0.8.0") pacs::pac_description("dplyr", at = as.Date("2019-02-01")) ## End(Not run)
## Not run: pacs::pac_description("dplyr", version = "0.8.0") pacs::pac_description("dplyr", at = as.Date("2019-02-01")) ## End(Not run)
a package health for a certain version or at a specific Date. By default works for the newest package version. A healthy package was published for more than x days, where default is 14 days. CRAN team gives around one/two week to resolved a package which gave errors under the check page. The newest release is checked for any warnings/errors on the R CRAN package check page.
pac_health( pac, version = NULL, at = NULL, limit = 14, scope = c("ERROR", "FAIL"), flavors = NULL, lib.loc = .libPaths(), repos = "https://cran.rstudio.com/", source = c("cran", "crandb") )
pac_health( pac, version = NULL, at = NULL, limit = 14, scope = c("ERROR", "FAIL"), flavors = NULL, lib.loc = .libPaths(), repos = "https://cran.rstudio.com/", source = c("cran", "crandb") )
pac |
|
version |
|
at |
|
limit |
|
scope |
|
flavors |
|
lib.loc |
|
repos |
character vector repositories URLs to use. Default |
source |
|
logical
if a package is healthy.
Results are cached for 30 minutes with memoise
package.
The crandb
R packages database is a part of METACRAN
project, source:
Csárdi G, Salmon M (2022). pkgsearch
: Search and Query CRAN R Packages. https://github.com/r-hub/pkgsearch
, https://r-hub.github.io/pkgsearch/
.
For source = "cran"
the function will scrap two CRAN URLS. Works only with CRAN packages.
Please as a courtesy to the R CRAN, don't overload their servers by constantly using this function.
## Not run: pacs::pac_health("memoise") pacs::pac_health("dplyr", version = "0.8.0", limit = 14) pacs::pac_health("dplyr", at = as.Date("2019-02-14")) pacs::pac_health("dplyr", limit = 14, scope = c("ERROR", "FAIL")) ## End(Not run)
## Not run: pacs::pac_health("memoise") pacs::pac_health("dplyr", version = "0.8.0", limit = 14) pacs::pac_health("dplyr", at = as.Date("2019-02-14")) pacs::pac_health("dplyr", limit = 14, scope = c("ERROR", "FAIL")) ## End(Not run)
using utils::available.packages
to check if package is in repositories.
pac_isin(pac, repos = biocran_repos())
pac_isin(pac, repos = biocran_repos())
pac |
|
repos |
character vector base URLs of the repositories to use. By default checking CRAN and newest Bioconductor per R version. Default |
logical
if a package is inside repositories.
Results are cached for 30 minutes with memoise
package.
## Not run: pac_isin("dplyr") pac_isin("dplyr", repos = "https://cran.rstudio.com/") pac_isin("dplyr", repos = biocran_repos()[grep("Bio", names(biocran_repos()))]) ## End(Not run)
## Not run: pac_isin("dplyr") pac_isin("dplyr", repos = "https://cran.rstudio.com/") pac_isin("dplyr", repos = biocran_repos()[grep("Bio", names(biocran_repos()))]) ## End(Not run)
checking if a package version is the most recent one, by default the installed version is compared.
pac_islast(pac, version = NULL, lib.loc = .libPaths(), repos = biocran_repos())
pac_islast(pac, version = NULL, lib.loc = .libPaths(), repos = biocran_repos())
pac |
|
version |
|
lib.loc |
|
repos |
|
logical
if a package is inside repositories.
Results are cached for 30 minutes with memoise
package.
## Not run: pac_islast("memoise") pac_islast("dplyr", version = "1.0.0") pac_islast("S4Vectors") pac_islast("S4Vectors", version = pac_last("S4Vectors")) ## End(Not run)
## Not run: pac_islast("memoise") pac_islast("dplyr", version = "1.0.0") pac_islast("S4Vectors") pac_islast("S4Vectors", version = pac_last("S4Vectors")) ## End(Not run)
using utils::available.packages
to get the newest package version.
pac_last(pac, repos = biocran_repos())
pac_last(pac, repos = biocran_repos())
pac |
|
repos |
|
character
most recent package version.
Results are cached for 30 minutes with memoise
package.
For Bioconductor the newest one per R version.
## Not run: pac_last("dplyr") pac_last("S4Vectors") ## End(Not run)
## Not run: pac_last("dplyr") pac_last("S4Vectors") ## End(Not run)
a package life duration for a certain version or at a specific Date. By default works for the newest package version.
pac_lifeduration( pac, version = NULL, at = NULL, lib.loc = .libPaths(), repos = biocran_repos(), source = c("cran", "crandb") )
pac_lifeduration( pac, version = NULL, at = NULL, lib.loc = .libPaths(), repos = biocran_repos(), source = c("cran", "crandb") )
pac |
|
version |
|
at |
|
lib.loc |
|
repos |
|
source |
|
difftime
, number of days package version was the newest one.
Results are cached for 30 minutes with memoise
package.
The crandb
R packages database is a part of METACRAN
project, source:
Csárdi G, Salmon M (2022). pkgsearch
: Search and Query CRAN R Packages. https://github.com/r-hub/pkgsearch
, https://r-hub.github.io/pkgsearch/
.
For source = "cran"
the function will scrap two CRAN URLS. Works only with CRAN packages.
Please as a courtesy to the R CRAN, don't overload their servers by constantly using this function.
## Not run: pacs::pac_lifeduration("memoise") pacs::pac_lifeduration("memoise", source = "cran") pacs::pac_lifeduration("dplyr", version = "0.8.0") pacs::pac_lifeduration("dplyr", at = as.Date("2019-02-14")) # For Bioconductor packages it will work only for the newest per R version and installed ones. pacs::pac_lifeduration("S4Vectors") ## End(Not run)
## Not run: pacs::pac_lifeduration("memoise") pacs::pac_lifeduration("memoise", source = "cran") pacs::pac_lifeduration("dplyr", version = "0.8.0") pacs::pac_lifeduration("dplyr", at = as.Date("2019-02-14")) # For Bioconductor packages it will work only for the newest per R version and installed ones. pacs::pac_lifeduration("S4Vectors") ## End(Not run)
CRAN package NAMESPACE file taken locally or remotely from GITHUB CRAN mirror or CRAN website. By default works for the newest package version.
pac_namespace( pac, version = NULL, at = NULL, local = FALSE, lib.loc = .libPaths(), repos = "https://cran.rstudio.com/" )
pac_namespace( pac, version = NULL, at = NULL, local = FALSE, lib.loc = .libPaths(), repos = "https://cran.rstudio.com/" )
pac |
|
version |
|
at |
|
local |
|
lib.loc |
|
repos |
|
list
with names proper for NAMESPACE file, the same as format as returned by base::parseNamespaceFile
.
Results are cached for 30 minutes with memoise
package.
This function is mainly built under source code from base::parseNamespaceFile
.
## Not run: pacs::pac_namespace("dplyr", version = "0.8.0") pacs::pac_namespace("dplyr", at = as.Date("2019-02-01")) pacs::pac_namespace("memoise", local = TRUE) ## End(Not run)
## Not run: pacs::pac_namespace("dplyr", version = "0.8.0") pacs::pac_namespace("dplyr", at = as.Date("2019-02-01")) pacs::pac_namespace("memoise", local = TRUE) ## End(Not run)
Get NEWS for a package from CRAN or local
pac_news( pac, version = NULL, at = NULL, local = FALSE, lib.loc = .libPaths(), repos = "https://cran.rstudio.com/" )
pac_news( pac, version = NULL, at = NULL, local = FALSE, lib.loc = .libPaths(), repos = "https://cran.rstudio.com/" )
pac |
|
version |
|
at |
|
local |
|
lib.loc |
|
repos |
|
character
with NEWS content.
Results are cached for 30 minutes with memoise
package.
## Not run: pacs::pac_news("dplyr", version = "0.8.0") pacs::pac_news("dplyr", at = as.Date("2019-02-01")) ## End(Not run)
## Not run: pacs::pac_news("dplyr", version = "0.8.0") pacs::pac_news("dplyr", at = as.Date("2019-02-01")) ## End(Not run)
Size of package.
pac_size(pac, lib.loc = .libPaths())
pac_size(pac, lib.loc = .libPaths())
pac |
|
lib.loc |
|
numeric
size in bytes, to get MB ten divide by 10**6
.
## Not run: cat(pacs::pac_size("stats") / 10**6, "MB") ## End(Not run)
## Not run: cat(pacs::pac_size("stats") / 10**6, "MB") ## End(Not run)
Using CRAN website to get a package metadata used at a specific Date or a Date interval or for specific version.
pac_timemachine( pac, at = NULL, from = NULL, to = NULL, version = NULL, source = c("cran", "crandb") )
pac_timemachine( pac, at = NULL, from = NULL, to = NULL, version = NULL, source = c("cran", "crandb") )
pac |
|
at |
|
from |
|
to |
|
version |
|
source |
|
data.frame
with 7 columns
character package name.
character package version.
character release Date
character archived Date.
difftime
number of days the version was the newest one.
character the suffix of the base URL to tar.gz
file. The base part of URL in the result is https://cran.r-project.org/src/contrib/
.
character size of the tar.gz
file.
Results are cached for 30 minutes with memoise
package.
The crandb
R packages database is a part of METACRAN
project, source:
Csárdi G, Salmon M (2022). pkgsearch
: Search and Query CRAN R Packages. https://github.com/r-hub/pkgsearch
, https://r-hub.github.io/pkgsearch/
.
For source = "cran"
the function will scrap two CRAN URLS. Works only with CRAN packages.
Please as a courtesy to the R CRAN, don't overload their servers by constantly using this function.
## Not run: pacs::pac_timemachine("dplyr") pacs::pac_timemachine("dplyr", at = as.Date("2017-02-02")) pacs::pac_timemachine("dplyr", from = as.Date("2017-02-02"), to = as.Date("2018-04-02")) pacs::pac_timemachine("dplyr", at = Sys.Date()) pacs::pac_timemachine("tidyr", from = as.Date("2020-06-01"), to = Sys.Date()) ## End(Not run)
## Not run: pacs::pac_timemachine("dplyr") pacs::pac_timemachine("dplyr", at = as.Date("2017-02-02")) pacs::pac_timemachine("dplyr", from = as.Date("2017-02-02"), to = as.Date("2018-04-02")) pacs::pac_timemachine("dplyr", at = Sys.Date()) pacs::pac_timemachine("tidyr", from = as.Date("2020-06-01"), to = Sys.Date()) ## End(Not run)
True size of the package as it takes into account its all dependencies, recursively.
pac_true_size( pac, fields = c("Depends", "Imports", "LinkingTo"), lib.loc = .libPaths(), exclude_joint = 0L )
pac_true_size( pac, fields = c("Depends", "Imports", "LinkingTo"), lib.loc = .libPaths(), exclude_joint = 0L )
pac |
|
fields |
|
lib.loc |
|
exclude_joint |
|
numeric
size in bytes, to get MB then divide by 10**6
.
R base packages are not counted. The default value of fields
should be suited for almost all scenarios.
## Not run: # size in MB, with all its dependencies pacs::pac_true_size("memoise") / 10**6 ## End(Not run)
## Not run: # size in MB, with all its dependencies pacs::pac_true_size("memoise") / 10**6 ## End(Not run)
Checking if installed package dependencies have correct versions taking into account their DESCRIPTION files requirements. Moreover identifying which packages are newest releases. Optionally we could add life duration and CRAN check page status for each dependency.
pac_validate( pac, lib.loc = .libPaths(), fields = c("Depends", "Imports", "LinkingTo"), lifeduration = FALSE, checkred = list(scope = character(0), flavors = NULL), repos = biocran_repos() )
pac_validate( pac, lib.loc = .libPaths(), fields = c("Depends", "Imports", "LinkingTo"), lifeduration = FALSE, checkred = list(scope = character(0), flavors = NULL), repos = biocran_repos() )
pac |
|
lib.loc |
|
fields |
|
lifeduration |
|
checkred |
|
repos |
|
data.frame
with 5/7/8/9 columns.
character a package name.
character expected by DESCRIPTION files minimal version. "" means not specified so the newest version.
character installed package version.
numeric -1/0/1 which comes from utils::compareVersion
function.
0 means that we have the same version as required by DESCRIPTION files. -1 means we have too low version installed, this is an error. 1 means we have higher version.
logical if the package is in the first dependency layer, direct dependencies from DESCRIPTION file.
logical (Internet needed) if the installed version is the newest one.
logical (Internet needed) if the package is on CRAN, version is not taken into account here.
(Optional) (Internet needed) logical if the NEWEST package contains any specified statuses on CRAN check page.
(Optional) (Internet needed) integer number of days a package was released.
Version.expected.min column not count packages which are not a dependency for any package, so could not be find in DESCRIPTION files.
When turn on the lifeduration
option, calculations might be time consuming when there is more than 500 packages.
Please as a courtesy to the R CRAN, don't overload their server by constantly using this function with lifeduration
or checkred
turned on.
Results are cached with memoise
package, memory cache.
The crandb
R packages database is a part of METACRAN
project, source:
Csárdi G, Salmon M (2022). pkgsearch
: Search and Query CRAN R Packages. https://github.com/r-hub/pkgsearch
, https://r-hub.github.io/pkgsearch/
.
## Not run: pacs::pac_validate("memoise") pacs::pac_validate( "memoise", lifeduration = TRUE, checkred = list(scope = c("ERROR", "FAIL"), flavors = NULL) ) pacs::pac_validate( "memoise", lifeduration = TRUE, checkred = list(scope = c("ERROR", "FAIL"), flavors = pacs::match_flavors()) ) ## End(Not run)
## Not run: pacs::pac_validate("memoise") pacs::pac_validate( "memoise", lifeduration = TRUE, checkred = list(scope = c("ERROR", "FAIL"), flavors = NULL) ) pacs::pac_validate( "memoise", lifeduration = TRUE, checkred = list(scope = c("ERROR", "FAIL"), flavors = pacs::match_flavors()) ) ## End(Not run)
get base packages, all or only startup
.
pacs_base(startup = FALSE)
pacs_base(startup = FALSE)
startup |
|
character
vector
## Not run: pacs_base() pacs_base(startup = TRUE) ## End(Not run)
## Not run: pacs_base() pacs_base(startup = TRUE) ## End(Not run)
packages life duration for certain versions.
pacs_lifeduration( pacs, versions, source = c("crandb", "loop_crandb", "loop_cran"), lib.loc = .libPaths(), repos = biocran_repos() )
pacs_lifeduration( pacs, versions, source = c("crandb", "loop_crandb", "loop_cran"), lib.loc = .libPaths(), repos = biocran_repos() )
pacs |
|
versions |
|
source |
character one of |
lib.loc |
|
repos |
|
data.frame
with two columns package name and life duration.
Results are cached for 30 minutes with memoise
package.
The crandb
R packages database is a part of METACRAN
project, source:
Csárdi G, Salmon M (2022). pkgsearch
: Search and Query CRAN R Packages. https://github.com/r-hub/pkgsearch
, https://r-hub.github.io/pkgsearch/
.
For source = "loop_cran"
the function will scrap two CRAN URLS. Works only with CRAN packages.
Please as a courtesy to the R CRAN, don't overload their servers by constantly using this function.
## Not run: pacs::pacs_lifeduration(c("dplyr", "tidyr"), c("1.0.0", "1.2.0")) pacs::pacs_lifeduration(c("dplyr", "tidyr"), c("1.0.0", "1.2.0"), source = "loop_cran") # last versions pacs::pacs_lifeduration(c("dplyr", "tidyr"), sapply(c("dplyr", "tidyr"), pacs::pac_last)) ## End(Not run)
## Not run: pacs::pacs_lifeduration(c("dplyr", "tidyr"), c("1.0.0", "1.2.0")) pacs::pacs_lifeduration(c("dplyr", "tidyr"), c("1.0.0", "1.2.0"), source = "loop_cran") # last versions pacs::pacs_lifeduration(c("dplyr", "tidyr"), sapply(c("dplyr", "tidyr"), pacs::pac_last)) ## End(Not run)