Skip to content

Commit 8f72633

Browse files
committed
replace is.rel() with is_rel()
1 parent ba76efc commit 8f72633

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

R/guide-axis-logticks.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ guide_axis_logticks <- function(
108108
if (is_bare_numeric(mid)) mid <- rel(mid)
109109
if (is_bare_numeric(short)) short <- rel(short)
110110

111-
check_fun <- function(x) (is.rel(x) || is.unit(x)) && length(x) == 1
111+
check_fun <- function(x) (is_rel(x) || is.unit(x)) && length(x) == 1
112112
what <- "a {.cls rel} or {.cls unit} object of length 1"
113113
check_object(long, check_fun, what)
114114
check_object(mid, check_fun, what)

R/theme-elements.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,12 @@ print.rel <- function(x, ...) print(noquote(paste(x, " *", sep = "")))
280280
#' Reports whether x is a rel object
281281
#' @param x An object to test
282282
#' @keywords internal
283-
is.rel <- function(x) inherits(x, "rel")
283+
is_rel <- function(x) inherits(x, "rel")
284+
285+
is.rel <- function(x) {
286+
deprecate_warn0("4.0.0", "is.rel()", "is_rel()")
287+
is_rel(x)
288+
}
284289

285290
#' Render a specified theme element into a grob
286291
#'

R/theme.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -904,9 +904,9 @@ combine_elements <- function(e1, e2) {
904904
}
905905

906906
# Inheritance of rel objects
907-
if (is.rel(e1)) {
907+
if (is_rel(e1)) {
908908
# Both e1 and e2 are rel, give product as another rel
909-
if (is.rel(e2)) {
909+
if (is_rel(e2)) {
910910
return(rel(unclass(e1) * unclass(e2)))
911911
}
912912
# If e2 is a unit/numeric, return modified unit/numeric
@@ -946,12 +946,12 @@ combine_elements <- function(e1, e2) {
946946
e1[n] <- e2[n]
947947

948948
# Calculate relative sizes
949-
if (is.rel(e1$size)) {
949+
if (is_rel(e1$size)) {
950950
e1$size <- e2$size * unclass(e1$size)
951951
}
952952

953953
# Calculate relative linewidth
954-
if (is.rel(e1$linewidth)) {
954+
if (is_rel(e1$linewidth)) {
955955
e1$linewidth <- e2$linewidth * unclass(e1$linewidth)
956956
}
957957

0 commit comments

Comments
 (0)