Skip to content

Commit abc62dd

Browse files
committed
inline is_dotted_var()
1 parent 79fa0b1 commit abc62dd

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

R/aes-evaluation.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,6 @@ stage_scaled <- function(start = NULL, after_stat = NULL, after_scale = NULL) {
207207
# Regex to determine if an identifier refers to a calculated aesthetic
208208
match_calculated_aes <- "^\\.\\.([a-zA-Z._]+)\\.\\.$"
209209

210-
is_dotted_var <- function(x) {
211-
grepl(match_calculated_aes, x)
212-
}
213-
214210
# Determine if aesthetic is calculated
215211
is_calculated_aes <- function(aesthetics, warn = FALSE) {
216212
vapply(aesthetics, is_calculated, warn = warn, logical(1), USE.NAMES = FALSE)
@@ -229,7 +225,8 @@ is_calculated <- function(x, warn = FALSE) {
229225
if (is.null(x) || is.atomic(x)) {
230226
FALSE
231227
} else if (is.symbol(x)) {
232-
res <- is_dotted_var(as.character(x))
228+
# Test if x is a dotted variable
229+
res <- grepl(match_calculated_aes, as.character(x))
233230
if (res && warn) {
234231
what <- I(paste0("The dot-dot notation (`", x, "`)"))
235232
var <- gsub(match_calculated_aes, "\\1", as.character(x))

0 commit comments

Comments
 (0)