-
Notifications
You must be signed in to change notification settings - Fork 3
/
report.qmd
82 lines (57 loc) · 5.03 KB
/
report.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
title: "functions and packages affected by deprecating rgdal, rgeos and maptools"
date: "11 August 2022"
format: html
---
The reason for these listings this is to find and anticipate what will happen when [rgdal, rgeos and maptools will retire](https://r-spatial.org/r/2022/04/12/evolution.html). Possibilities to migrate to more modern functions in package `sf` are given [here](https://github.com/r-spatial/sf/wiki/Migrating).
## `pkgapi` analysis
The tables below, created from analysing and filtering the output from running `pkgapi::map_package()` on all packages meeting `tools::package_dependencies(packages = <pkg>, tools::available.packages(), which = "most", recursive = FALSE, reverse = TRUE)`, where `<pkg>` are `maptools`, `rgeos` and `rgdal` each run separately, list:
* which functions in packages `maptools`, `rgeos` and `rgdal` are used by which packages, ordered by the number of packages affected, and
* the functions in `maptools`, `rgeos` and `rgeos` that are called by each package involved, ordered by the number of functions involved
Note that this only concerns _exported functions_, not S3 or S4 methods, and so gives an under estimation of the amount of dependency on the three packages.
### By deprecating function
```{r}
r = read.csv("pkgapi_220811.csv", header = FALSE)
r$packages = lengths(strsplit(r[[3]], " "))
r$`function` = paste(r[[1]], r[[2]], sep = ":")
r$`packages involved` = r[["V3"]]
r[["V1"]] = r[["V2"]] = r[["V3"]] = NULL
r_o = r[order(r$packages, decreasing = TRUE),]
library(knitr)
kable(r_o, row.names = FALSE)
```
### By depending package
```{r}
r = read.csv("pkgapi_by_pkg_220811.csv", header = FALSE)
names(r) = c("package", "functions involved")
r$functions = lengths(strsplit(r$`functions involved`, " ")) # - 1 # leading space
kable(r[order(r$functions, decreasing = TRUE),c(3,1,2)], row.names = FALSE)
```
### Impending changes in `raster`
Many packages using `raster` declare `rgeos` and/or `rgdal` as required in some form, but very recent changes in `raster`, removing both these packages entirely from `DESCRIPTION`, will in time propagate, so that declarations of these packages in packages really only needing `raster` can be deleted soon.
A run of `pkgapi::map_package("raster")` on the development source of the package shows that calls to the retiring packages have gone:
```
> unique(sapply(pkgapi::map_package("raster")$calls$to, function(x) strsplit(x, "::")[[1]][1]))
[1] "methods" "base" "sp" ""
[5] "raster" "grDevices" "NA" "stats"
[9] "utils" "parallel" "graphics" "igraph"
[13] "ncdf4" "sf" "exactextractr" "terra"
[17] "pkgload" "MASS" "tcltk" "Rcpp"
```
## Reverse dependency checks
Reverse dependency checks were run using the development versions of `raster`, `terra` and `Matrix` as of 2022-08-27. The analysed reverse dependencies were taken from `tools::package_dependencies(packages = c("sp", "maptools", "rgdal", "rgeos", "raster"), tools::available.packages(), which = "most", recursive = FALSE, reverse = TRUE)`. The checks were run without `maptools`, `rgeos` and `rgdal` installed on the platform. The environment variable `"_SP_EVOLUTION_STATUS_=2` was set to route calls from `sp` to functons for CRS handling and datum transformation in absent `rgdal` to `sf`.
In total 880 packages were checked, compared to 232 subjected to `pkgapi::map_package()` analysis. Of the 880 packages, 376 were error checks, and 576 at worst warnings.
The first table subsets the check results by package to the 232 packages listed above from `pkgapi::map_package()` analysis. The listing shows the package name for packages with both reverse depencency check and `pkgapi` analysis, CRAN version checked, counts of check outcomes (error, warning, note), and a logical variable if `error > 0` (27 packages did not check error, 205 checked error):
```{r}
r = read.csv("revdeps_pkgapi_220827.csv")
kable(r, row.names = FALSE)
```
The second table shows 360 of the total 376 check error packages classified by broad error causes, where `required` are packages declaring dependency on or import from `maptools`, `rgeos` and/or `rgdal`. The smaller categories are `req_by_req_pkg`: usually a load failure on installation caused by an upstream package imported by the failing package itself declaring dependency on or import from `maptools`, `rgeos` and/or `rgdal`, and `no_pkg`: often an unconditional use of a suggested `maptools`, `rgeos` and/or `rgdal` in examples, tests or vignettes. The remaining 16 cases have not yet been analysed.
```{r}
r = read.csv("revdep_error_types_220827.csv")
kable(table(r$type))
```
The final table lists all the 360 chosen check error packages by type of failure, and for `required` and `no_pkg`, which of the retiring packages were the cause(s) of the failure (boolean except for `no_pkg` where a count of cases is shown). Without further detailed analysis, `req_by_req_pkg` is not assigned the retiring package or the intermediate failing package.
```{r}
kable(r)
```