Reputation: 4184
Regularly we are using the utils::packageDescription
function to retrieve a DESCRIPTION file for any local package. Unfortunately it is not easy to compare DESCRIPTION files between different package versions. Mostly we want to get diff of dependencies (Depends/Imports/Suggests) between different package versions.
How to achieve such objective.
Upvotes: 0
Views: 44
Reputation: 4184
My own solution for such problem is offered in pacs
CRAN package.
pacs::pac_compare_versions
could be used to compare package dependencies between different package versions.
pacs::pac_description
is offered to enable download of DESCRIPTION file for any package version or at a specific Date.
Functions are supported for R CRAN packages.
Comparing a package dependencies.
# by default c("Imports", "Depends", "LinkingTo") fields are considered
pacs::pac_compare_versions("dplyr", "0.8.1", "1.0.0")
#> Package Version.0.8.1 Version.1.0.0 version_status
#> 1 assertthat 0.2.1 <NA> -1
#> 2 BH 1.69.0-1 <NA> -1
#> 3 ellipsis <NA> 1
#> 4 generics <NA> 1
#> 5 glue 1.3.1 1.3.2 1
#> 6 lifecycle <NA> 0.2.0 1
#> 7 magrittr 1.5 1.5 0
#> 8 methods 0
#> 9 pkgconfig 2.0.2 <NA> -1
#> 10 plogr 0.2.0 <NA> -1
#> 11 R 3.2.0 3.2.0 0
#> 12 R6 2.4.0 -1
#> 13 Rcpp 1.0.1 <NA> -1
#> 14 rlang 0.3.4 0.4.6 1
#> 15 tibble 2.1.1 2.1.3 1
#> 16 tidyselect 0.2.5 1.1.0 1
#> 17 utils 0
#> 18 vctrs <NA> 0.3.0 1
Raw DESCRIPTION files for a version or at Date.
head(pacs::pac_description("dplyr", "0.8.1"), 3)
#> $Type
#> [1] "Package"
#>
#> $Package
#> [1] "dplyr"
#>
#> $Title
#> [1] "A Grammar of Data Manipulation"
head(pacs::pac_description("dplyr", at = as.Date("2018-01-01")), 3)
#> $Type
#> [1] "Package"
#>
#> $Package
#> [1] "dplyr"
#>
#> $Version
#> [1] "0.7.4"
Comparing DESCRIPTION files, field by field.
x <- data.frame(`0.8.1` = I(pacs::pac_description("dplyr", "0.8.1")))
y <- data.frame(`1.0.0` = I(pacs::pac_description("dplyr", "1.0.0")))
head(merge(x, y, by = 0), 3)
#> Row.names X0.8.1 X1.0.0
#> 1 Author Hadley W.... Hadley W....
#> 2 Authors@R c(\nperson.... c(person....
#> 3 BugReports https://.... https://....
Created on 2021-09-11 by the reprex package (v2.0.1)
Upvotes: 0