forked from tidyverse/ggplot2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackports.R
21 lines (19 loc) · 928 Bytes
/
backports.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Backport fix from R 3.3:
# https://github.com/wch/r-source/commit/4efc81c98d262f93de9e7911aaa910f5c63cd00f
if (getRversion() < 3.3) {
absolute.units <- getFromNamespace("absolute.units", "grid")
absolute.units.unit <- getFromNamespace("absolute.units.unit", "grid")
absolute.units.unit.list <- getFromNamespace("absolute.units.unit.list", "grid")
absolute.units.unit.arithmetic <- getFromNamespace("absolute.units.unit.arithmetic", "grid")
backport_unit_methods <- function() {
registerS3method("absolute.units", "unit", absolute.units.unit)
registerS3method("absolute.units", "unit.list", absolute.units.unit.list)
registerS3method("absolute.units", "unit.arithmetic", absolute.units.unit.arithmetic)
}
} else {
backport_unit_methods <- function() {}
}
# isFALSE() is available on R (>=3.5)
if (getRversion() < 3.5) {
isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x
}