Skip to content

Commit 3d1e9b2

Browse files
authored
Fixes Delete code for old versions of R (#6632)
1 parent 57414df commit 3d1e9b2

File tree

2 files changed

+0
-35
lines changed

2 files changed

+0
-35
lines changed

R/backports.R

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,7 @@
1-
# Backport fix from R 3.3:
2-
# https://github.com/wch/r-source/commit/4efc81c98d262f93de9e7911aaa910f5c63cd00f
3-
if (getRversion() < "3.3") {
4-
absolute.units <- utils::getFromNamespace("absolute.units", "grid")
5-
absolute.units.unit <- utils::getFromNamespace("absolute.units.unit", "grid")
6-
absolute.units.unit.list <- utils::getFromNamespace("absolute.units.unit.list", "grid")
7-
absolute.units.unit.arithmetic <- utils::getFromNamespace("absolute.units.unit.arithmetic", "grid")
8-
9-
backport_unit_methods <- function() {
10-
registerS3method("absolute.units", "unit", absolute.units.unit)
11-
registerS3method("absolute.units", "unit.list", absolute.units.unit.list)
12-
registerS3method("absolute.units", "unit.arithmetic", absolute.units.unit.arithmetic)
13-
}
14-
} else {
15-
backport_unit_methods <- function() {}
16-
}
17-
181
# enable usage of <S7_object>@name in package code
192
#' @rawNamespace if (getRversion() < "4.3.0") importFrom("S7", "@")
203
NULL
214

22-
on_load(backport_unit_methods())
23-
245
unitType <- function(x) {
256
unit <- attr(x, "unit")
267
if (!is.null(unit)) {

R/geom-polygon.R

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ GeomPolygon <- ggproto("GeomPolygon", Geom,
4141
)
4242
)
4343
} else {
44-
if (getRversion() < "3.6") {
45-
cli::cli_abort("Polygons with holes requires R 3.6 or above.")
46-
}
4744
# Sort by group to make sure that colors, fill, etc. come in same order
4845
munched <- munched[order(munched$group, munched$subgroup), ]
4946
id <- match(munched$subgroup, unique0(munched$subgroup))
@@ -177,16 +174,3 @@ GeomPolygon <- ggproto("GeomPolygon", Geom,
177174
#' p
178175
#' }
179176
geom_polygon <- make_constructor(GeomPolygon)
180-
181-
# Assigning pathGrob in .onLoad ensures that packages that subclass GeomPolygon
182-
# do not install with error `possible error in 'pathGrob(munched$x, munched$y, ':
183-
# unused argument (pathId = munched$group)` despite the fact that this is correct
184-
# usage
185-
pathGrob <- NULL
186-
on_load(
187-
if (getRversion() < as.numeric_version("3.6")) {
188-
pathGrob <- function(..., pathId.lengths) {
189-
grid::pathGrob(...)
190-
}
191-
}
192-
)

0 commit comments

Comments
 (0)