Title: | Supplementary Tools for R Packages Developers |
Version: | 0.6.0 |
Maintainer: | Maciej Nasinski <nasinski.maciej@gmail.com> |
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. |
License: | GPL (≥ 3) |
URL: | https://github.com/Polkas/pacs, https://polkas.github.io/pacs/ |
BugReports: | https://github.com/Polkas/pacs/issues |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.2 |
Depends: | R (≥ 3.5.0) |
Imports: | curl, memoise, jsonlite, xml2, stringi |
Suggests: | remotes, renv, withr, pkgsearch, mockery, testthat (≥ 3.0.0), knitr, rmarkdown |
Config/testthat/edition: | 3 |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2024-09-27 20:26:13 UTC; maciejnasinski |
Author: | Maciej Nasinski [aut, cre] |
Repository: | CRAN |
Date/Publication: | 2024-09-27 22:10:02 UTC |
The shiny app dependencies
Description
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.
Usage
app_deps(
path = ".",
fields = c("Depends", "Imports", "LinkingTo"),
lib.loc = .libPaths(),
local = TRUE,
base = FALSE,
description_v = FALSE,
recursive = TRUE,
repos = biocran_repos()
)
Arguments
path |
|
fields |
|
lib.loc |
|
local |
|
base |
|
description_v |
|
recursive |
|
repos |
|
Value
character
vector with dependency packages or data.frame when checking recursively.
Note
renv
package has to be installed.
Examples
## 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)
Size of the shiny app
Description
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.
Usage
app_size(
path = ".",
fields = c("Depends", "Imports", "LinkingTo"),
lib.loc = .libPaths(),
recursive = TRUE
)
Arguments
path |
|
fields |
|
lib.loc |
|
recursive |
|
Value
numeric
size in bytes, to get MB ten divide by 10**6
.
Note
renv
package has to be installed. base
packages (pacs::pacs_base()
) are not taken into account.
Examples
## 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)
List Available Packages at CRAN-like Repositories
Description
available_packages returns a matrix of details corresponding to packages currently available at one or more repositories. The current list of packages is downloaded over the internet (or copied from a local mirror).
Usage
available_packages(repos)
Arguments
repos |
character vector URLs of the repositories to use. By default checking CRAN and newest Bioconductor per R version. Default |
Retrieving all Bioconductor releases
Description
Retrieving all Bioconductor releases.
The data is downloaded from https://www.bioconductor.org/about/release-announcements/
.
Usage
bio_releases()
Value
data.frame
with the same structure as the html table on https://www.bioconductor.org/about/release-announcements/
.
Note
Results are cached for 30 minutes with memoise
package.
Examples
## Not run:
pacs::bio_releases()
## End(Not run)
CRAN and Bioconductor repositories
Description
CRAN and Bioconductor repositories. The newest Bioconductor release for the specific R version is assumed.
Usage
biocran_repos(version = NULL)
Arguments
version |
|
Value
named character
vector of repositories.
Note
The Internet connection is needed to get Bioconductor repositories.
Examples
## Not run:
pacs::biocran_repos()
## End(Not run)
Retrieving all R CRAN packages check pages statuses.
Description
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
.
Usage
checked_packages()
Value
data.frame
with the same structure as the html table on https://cran.r-project.org/web/checks/check_summary_by_package.html
.
Note
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.
Examples
## Not run:
pacs::checked_packages()
## End(Not run)
Maximum version across the vector
Description
Reduce function over the utils::compareVersion
Usage
compareVersionsMax(vec, na.rm = TRUE)
Arguments
vec |
|
na.rm |
|
Value
character
maximum version
Examples
compareVersionsMax(c("1.1.1", "0.2.0"))
Minimum version across the vector
Description
Reduce function over the utils::compareVersion
Usage
compareVersionsMin(vec, na.rm = TRUE)
Arguments
vec |
|
na.rm |
|
Value
character
minimal version
Examples
compareVersionsMin(c("1.1.1", "0.2.0"))
Retrieving all R CRAN servers flavors
Description
Retrieving all R CRAN servers flavors.
The data is downloaded from https://cran.r-project.org/web/checks/check_flavors.html
.
Usage
cran_flavors()
Value
data.frame
with the same structure as the html table on https://cran.r-project.org/web/checks/check_flavors.html
.
Note
Results are cached for 30 minutes with memoise
package.
Examples
## Not run:
pacs::cran_flavors()
## End(Not run)
Size of the package
Description
size of package.
Usage
dir_size(path = ".", recursive = TRUE)
Arguments
path |
|
recursive |
|
Value
numeric
size in bytes, to get MB ten divide by 10**6
.
Examples
## Not run:
cat(pacs::dir_size(system.file(package = "stats")) / 10**6, "MB")
## End(Not run)
Validate the local library
Description
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.
Usage
lib_validate(
lib.loc = .libPaths(),
fields = c("Depends", "Imports", "LinkingTo"),
lifeduration = FALSE,
checkred = list(scope = character(0), flavors = NULL),
built = FALSE,
repos = biocran_repos()
)
Arguments
lib.loc |
|
fields |
|
lifeduration |
|
checkred |
|
built |
|
repos |
|
Value
data.frame
with 4/6/8/9/10 columns.
- Package
character a package name.
- Version.expected.min
character expected by DESCRIPTION files minimal version. "" means not specified so the newest version.
- Version.have
character installed package version.
- version_status
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.- built
character package was built under this R version
- built_status
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.
- newest
logical (Internet needed) if the installed version is the newest one. For Bioconductor if is the newest one per R version.
- cran
logical (Internet needed) if the package is on CRAN, version is not taken into account here.
- checkred
(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.- lifeduration
(Optional) (Internet needed) integer number of days a package was released.
Note
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/
.
Examples
## 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)
Validate a specific renv lock file
Description
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.
Usage
lock_validate(
path,
lifeduration = FALSE,
checkred = list(scope = character(0), flavors = NULL),
lib.loc = .libPaths(),
repos = biocran_repos()
)
Arguments
path |
|
lifeduration |
|
checkred |
|
lib.loc |
|
repos |
|
Value
data.frame
with 2/6/7/8 columns.
- Package
character a package name.
- Version.expected.min
(conditional) (Internet needed) character expected by DESCRIPTION files minimal version. "" means not specified so the newest version.
- Version.expected
character package version in the renv lock file.
- version_status
(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.- newest
logical (Internet needed) if the installed version is the newest one.
- cran
logical (Internet needed) if the package is on CRAN, version is not taken into account here.
- checkred
(Optional) (Internet needed) logical if the NEWEST package contains any specified statuses on CRAN check page.
- lifeduration
(Optional) (Internet needed) integer number of days a package was released.
Note
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/
.
Examples
## 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)
Get all matched CRAN servers to the local OS
Description
CRAN servers matched to the local OS
.
Usage
match_flavors()
Value
character
vector matched server names.
Note
The Internet connection is needed to use the function.
Examples
## Not run:
pacs::match_flavors()
## End(Not run)
Retrieving the R CRAN package check page
Description
Retrieving the R CRAN package check page.
Usage
pac_checkpage(pac)
Arguments
pac |
|
Value
data.frame
.
Note
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.
Examples
## Not run:
pacs::pac_checkpage("dplyr")
## End(Not run)
Checking the R CRAN package check page status
Description
using package R CRAN check page to validate if there are ANY errors and/or fails and/or warnings and/or notes.
Usage
pac_checkred(pac, scope = c("ERROR", "FAIL"), flavors = NULL)
Arguments
pac |
|
scope |
|
flavors |
|
Value
logical
if the package fail under specified criteria.
Note
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.
Examples
## 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)
Compare NAMESPACE exports between specific CRAN packages versions
Description
using the remote github CRAN mirror to compare NAMESPACE exports between specific packages versions.
Usage
pac_compare_namespace(
pac,
old = NULL,
new = NULL,
lib.loc = .libPaths(),
repos = "https://cran.rstudio.com/"
)
Arguments
pac |
|
old |
|
new |
|
lib.loc |
|
repos |
|
Value
list
with c("imports", "exports", "exportPatterns", "importClasses", "importMethods", "exportClasses", "exportMethods", "exportClassPatterns", "dynlibs", "S3methods")
slots, and added and removed ones for each of them.
Examples
## 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)
Compare NEWS files between specific CRAN packages versions
Description
using the remote github CRAN mirror to compare NEWS files between specific packages versions.
Usage
pac_compare_news(
pac,
old = NULL,
new = NULL,
lib.loc = .libPaths(),
repos = "https://cran.rstudio.com/"
)
Arguments
pac |
|
old |
|
new |
|
lib.loc |
|
repos |
|
Value
character
with NEWS content between specific versions.
Examples
## 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)
Compare DESCRIPTION files dependencies between specific CRAN packages versions
Description
using the remote github CRAN mirror to compare DESCRIPTION files dependencies between specific packages versions.
Usage
pac_compare_versions(
pac,
old = NULL,
new = NULL,
fields = c("Imports", "Depends", "LinkingTo"),
lib.loc = .libPaths(),
repos = "https://cran.rstudio.com/"
)
Arguments
pac |
|
old |
|
new |
|
fields |
|
lib.loc |
|
repos |
|
Value
data.frame
with 4 columns.
- Package
character package names.
- Version.OLD
character versions of dependencies required by an old package version.
- Version.NEW
character versions of dependencies required by a new package version.
- version_status
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.
Examples
## 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
Description
Package dependencies from DESCRIPTION files with installed or expected versions or newest released.
Usage
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()
)
Arguments
pac |
|
fields |
|
lib.loc |
|
base |
|
local |
logical if to use local repository (or newest remote packages). Default: TRUE |
description_v |
|
attr |
|
recursive |
|
repos |
|
Value
data.frame
with packages and their versions. Versions are taken from installed.packages
or newest released.
Note
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)
.
Examples
## 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)
Package dependencies - developer perspective
Description
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.
Usage
pac_deps_dev(
pac,
base = FALSE,
local = FALSE,
attr = TRUE,
repos = pacs::biocran_repos()
)
Arguments
pac |
|
base |
|
local |
|
attr |
|
repos |
|
Value
data.frame
with packages and their versions. Versions are taken from installed.packages
or newest released.
Examples
## 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)
Package direct dependencies and number of dependencies for each of them
Description
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.
Usage
pac_deps_heavy(
pac,
fields = c("Depends", "Imports", "LinkingTo"),
lib.loc = .libPaths(),
base = FALSE,
local = FALSE,
repos = pacs::biocran_repos()
)
Arguments
pac |
|
fields |
|
lib.loc |
|
base |
|
local |
|
repos |
|
Value
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).
Note
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.
Examples
## Not run:
pacs::pac_deps_heavy("caret")
pacs::pac_deps_heavy("dplyr")
## End(Not run)
R CRAN package dependencies for a certain version or time point
Description
Package dependencies from DESCRIPTION files retrieved recursively for certain version or time point.
Usage
pac_deps_timemachine(
pac,
version = NULL,
at = NULL,
fields = c("Depends", "Imports", "LinkingTo"),
recursive = TRUE
)
Arguments
pac |
|
version |
|
at |
|
fields |
|
recursive |
|
Value
named vector
package dependencies and their versions at the release date of main package plus one day.
Note
Longer lived version is taken if 2 is available at the same date (switch time).
Examples
## 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)
Package dependencies - user perspective
Description
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.
Usage
pac_deps_user(
pac,
base = FALSE,
local = FALSE,
attr = TRUE,
repos = pacs::biocran_repos()
)
Arguments
pac |
|
base |
|
local |
|
attr |
|
repos |
|
Value
data.frame
with packages and their versions. Versions are taken from installed.packages
or newest released.
Examples
## 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)
package DESCRIPTION file
Description
CRAN package DESCRIPTION file taken locally or remotely from GITHUB CRAN mirror or CRAN website. By default works for the newest package version.
Usage
pac_description(
pac,
version = NULL,
at = NULL,
local = FALSE,
lib.loc = .libPaths(),
repos = "https://cran.rstudio.com/"
)
Arguments
pac |
|
version |
|
at |
|
local |
|
lib.loc |
|
repos |
|
Value
list
with names proper for DESCRIPTION file fields.
Note
Results are cached for 30 minutes with memoise
package.
Examples
## Not run:
pacs::pac_description("dplyr", version = "0.8.0")
pacs::pac_description("dplyr", at = as.Date("2019-02-01"))
## End(Not run)
CRAN package health state at a specific Date or for a specific version
Description
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.
Usage
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")
)
Arguments
pac |
|
version |
|
at |
|
limit |
|
scope |
|
flavors |
|
lib.loc |
|
repos |
character vector repositories URLs to use. Default |
source |
|
Value
logical
if a package is healthy.
Note
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.
Examples
## 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)
Checking if a package is in repositories
Description
using utils::available.packages
to check if package is in repositories.
Usage
pac_isin(pac, repos = biocran_repos())
Arguments
pac |
|
repos |
character vector base URLs of the repositories to use. By default checking CRAN and newest Bioconductor per R version. Default |
Value
logical
if a package is inside repositories.
Note
Results are cached for 30 minutes with memoise
package.
Examples
## 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
Description
checking if a package version is the most recent one, by default the installed version is compared.
Usage
pac_islast(pac, version = NULL, lib.loc = .libPaths(), repos = biocran_repos())
Arguments
pac |
|
version |
|
lib.loc |
|
repos |
|
Value
logical
if a package is inside repositories.
Note
Results are cached for 30 minutes with memoise
package.
Examples
## 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)
Getting the most recent package version
Description
using utils::available.packages
to get the newest package version.
Usage
pac_last(pac, repos = biocran_repos())
Arguments
pac |
|
repos |
|
Value
character
most recent package version.
Note
Results are cached for 30 minutes with memoise
package.
For Bioconductor the newest one per R version.
Examples
## Not run:
pac_last("dplyr")
pac_last("S4Vectors")
## End(Not run)
Package version life duration at specific Date or for a specific version
Description
a package life duration for a certain version or at a specific Date. By default works for the newest package version.
Usage
pac_lifeduration(
pac,
version = NULL,
at = NULL,
lib.loc = .libPaths(),
repos = biocran_repos(),
source = c("cran", "crandb")
)
Arguments
pac |
|
version |
|
at |
|
lib.loc |
|
repos |
|
source |
|
Value
difftime
, number of days package version was the newest one.
Note
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.
Examples
## 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)
package NAMESPACE file
Description
CRAN package NAMESPACE file taken locally or remotely from GITHUB CRAN mirror or CRAN website. By default works for the newest package version.
Usage
pac_namespace(
pac,
version = NULL,
at = NULL,
local = FALSE,
lib.loc = .libPaths(),
repos = "https://cran.rstudio.com/"
)
Arguments
pac |
|
version |
|
at |
|
local |
|
lib.loc |
|
repos |
|
Value
list
with names proper for NAMESPACE file, the same as format as returned by base::parseNamespaceFile
.
Note
Results are cached for 30 minutes with memoise
package.
This function is mainly built under source code from base::parseNamespaceFile
.
Examples
## 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
Description
Get NEWS for a package from CRAN or local
Usage
pac_news(
pac,
version = NULL,
at = NULL,
local = FALSE,
lib.loc = .libPaths(),
repos = "https://cran.rstudio.com/"
)
Arguments
pac |
|
version |
|
at |
|
local |
|
lib.loc |
|
repos |
|
Value
character
with NEWS content.
Note
Results are cached for 30 minutes with memoise
package.
Examples
## 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 the package
Description
Size of package.
Usage
pac_size(pac, lib.loc = .libPaths())
Arguments
pac |
|
lib.loc |
|
Value
numeric
size in bytes, to get MB ten divide by 10**6
.
Examples
## Not run:
cat(pacs::pac_size("stats") / 10**6, "MB")
## End(Not run)
Package metadata for all releases
Description
Using CRAN website to get a package metadata used at a specific Date or a Date interval or for specific version.
Usage
pac_timemachine(
pac,
at = NULL,
from = NULL,
to = NULL,
version = NULL,
source = c("cran", "crandb")
)
Arguments
pac |
|
at |
|
from |
|
to |
|
version |
|
source |
|
Value
data.frame
with 7 columns
- Package
character package name.
- Version
character package version.
- Released
character release Date
- Archived
character archived Date.
- LifeDuration
difftime
number of days the version was the newest one.- URL
character the suffix of the base URL to
tar.gz
file. The base part of URL in the result ishttps://cran.r-project.org/src/contrib/
.- Size
character size of the
tar.gz
file.
Note
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.
Examples
## 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
Description
True size of the package as it takes into account its all dependencies, recursively.
Usage
pac_true_size(
pac,
fields = c("Depends", "Imports", "LinkingTo"),
lib.loc = .libPaths(),
exclude_joint = 0L
)
Arguments
pac |
|
fields |
|
lib.loc |
|
exclude_joint |
|
Value
numeric
size in bytes, to get MB then divide by 10**6
.
Note
R base packages are not counted. The default value of fields
should be suited for almost all scenarios.
Examples
## Not run:
# size in MB, with all its dependencies
pacs::pac_true_size("memoise") / 10**6
## End(Not run)
Validate a specific local package
Description
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.
Usage
pac_validate(
pac,
lib.loc = .libPaths(),
fields = c("Depends", "Imports", "LinkingTo"),
lifeduration = FALSE,
checkred = list(scope = character(0), flavors = NULL),
repos = biocran_repos()
)
Arguments
pac |
|
lib.loc |
|
fields |
|
lifeduration |
|
checkred |
|
repos |
|
Value
data.frame
with 5/7/8/9 columns.
- Package
character a package name.
- Version.expected.min
character expected by DESCRIPTION files minimal version. "" means not specified so the newest version.
- Version.have
character installed package version.
- version_status
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.- direct
logical if the package is in the first dependency layer, direct dependencies from DESCRIPTION file.
- newest
logical (Internet needed) if the installed version is the newest one.
- cran
logical (Internet needed) if the package is on CRAN, version is not taken into account here.
- checkred
(Optional) (Internet needed) logical if the NEWEST package contains any specified statuses on CRAN check page.
- lifeduration
(Optional) (Internet needed) integer number of days a package was released.
Note
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/
.
Examples
## 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 R packages
Description
get base packages, all or only startup
.
Usage
pacs_base(startup = FALSE)
Arguments
startup |
|
Value
character
vector
Examples
## Not run:
pacs_base()
pacs_base(startup = TRUE)
## End(Not run)
Packages life duration for a specific version
Description
packages life duration for certain versions.
Usage
pacs_lifeduration(
pacs,
versions,
source = c("crandb", "loop_crandb", "loop_cran"),
lib.loc = .libPaths(),
repos = biocran_repos()
)
Arguments
pacs |
|
versions |
|
source |
character one of |
lib.loc |
|
repos |
|
Value
data.frame
with two columns package name and life duration.
Note
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.
Examples
## 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)
Read a file from CRAN
Description
Read a file from CRAN package source.
Usage
read_cran_file(pac, version, file, repos = "https://cran.rstudio.com/")
Arguments
pac |
|
version |
|
file |
|
repos |
|
Read a file from a GitHub CRAN repository
Description
Read a file from a GitHub CRAN repository.
Usage
read_github_file(pac, version, file, repos = "https://cran.rstudio.com/")
Arguments
pac |
|
version |
|
file |
|
repos |
|
Note
if the file is not found in the GitHub repository, it will try to find it in the CRAN archive.
Standard Template Arguments
Description
Standard Template Arguments
Arguments
at |
|
attr |
|
base |
|
built |
|
checkred |
|
description_v |
|
exclude_joint |
|
file |
|
fields |
|
flavors |
|
from |
|
lib.loc |
|
lifeduration |
|
limit |
|
local |
|
na.rm |
|
new |
|
old |
|
pac |
|
pacs |
|
path |
|
repos |
|
recursive |
|
scope |
|
source |
|
startup |
|
to |
|
vec |
|
version |
|
versions |
|
validate compare input
Description
validate compare input
Usage
validate_compare_input(pac, old, new, lib.loc, repos)
Append a data.frame with online attributes
Description
internal function to append a data.frame with an online related sources.
The input data.frame has a specific structure, such contain c("Package", version_name_new)
columns.
Usage
validate_online(
result,
version_name_new = "Version.expected",
lifeduration,
checkred,
repos,
lib.loc = .libPaths()
)
validate pac input
Description
validate pac input
Usage
validate_pac_input(pac, version, at, local, lib.loc, repos)