@@ -225,7 +225,7 @@ Facet <- ggproto("Facet", NULL,
225225# ' # Thanks to tidy eval idioms we now have another useful wrapper:
226226# ' p + wrap_cut(drat)
227227vars <- function (... ) {
228- rlang :: quos(... )
228+ quos(... )
229229}
230230
231231
@@ -278,29 +278,29 @@ as_facets_list <- function(x) {
278278 if (inherits(x , " uneval" )) {
279279 stop(" Please use `vars()` to supply facet variables" , call. = FALSE )
280280 }
281- if (rlang :: is_quosures(x )) {
282- x <- rlang :: quos_auto_name(x )
281+ if (is_quosures(x )) {
282+ x <- quos_auto_name(x )
283283 return (list (x ))
284284 }
285285
286286 # This needs to happen early because we might get a formula.
287287 # facet_grid() directly converted strings to a formula while
288288 # facet_wrap() called as.quoted(). Hence this is a little more
289289 # complicated for backward compatibility.
290- if (rlang :: is_string(x )) {
291- x <- rlang :: parse_expr(x )
290+ if (is_string(x )) {
291+ x <- parse_expr(x )
292292 }
293293
294294 # At this level formulas are coerced to lists of lists for backward
295295 # compatibility with facet_grid(). The LHS and RHS are treated as
296296 # distinct facet dimensions and `+` defines multiple facet variables
297297 # inside each dimension.
298- if (rlang :: is_formula(x )) {
298+ if (is_formula(x )) {
299299 return (f_as_facets_list(x ))
300300 }
301301
302302 # For backward-compatibility with facet_wrap()
303- if (! rlang :: is_bare_list(x )) {
303+ if (! is_bare_list(x )) {
304304 x <- as_quoted(x )
305305 }
306306
@@ -316,9 +316,9 @@ as_facets_list <- function(x) {
316316
317317# Flatten a list of quosures objects to a quosures object, and compact it
318318compact_facets <- function (x ) {
319- x <- rlang :: flatten_if(x , rlang :: is_list )
320- null <- vapply(x , rlang :: quo_is_null , logical (1 ))
321- rlang :: new_quosures(x [! null ])
319+ x <- flatten_if(x , is_list )
320+ null <- vapply(x , quo_is_null , logical (1 ))
321+ new_quosures(x [! null ])
322322}
323323
324324# Compatibility with plyr::as.quoted()
@@ -327,29 +327,29 @@ as_quoted <- function(x) {
327327 if (length(x ) > 1 ) {
328328 x <- paste(x , collapse = " ; " )
329329 }
330- return (rlang :: parse_exprs(x ))
330+ return (parse_exprs(x ))
331331 }
332332 if (is.null(x )) {
333333 return (list ())
334334 }
335- if (rlang :: is_formula(x )) {
335+ if (is_formula(x )) {
336336 return (simplify(x ))
337337 }
338338 list (x )
339339}
340340# From plyr:::as.quoted.formula
341341simplify <- function (x ) {
342- if (length(x ) == 2 && rlang :: is_symbol(x [[1 ]], " ~" )) {
342+ if (length(x ) == 2 && is_symbol(x [[1 ]], " ~" )) {
343343 return (simplify(x [[2 ]]))
344344 }
345345 if (length(x ) < 3 ) {
346346 return (list (x ))
347347 }
348348 op <- x [[1 ]]; a <- x [[2 ]]; b <- x [[3 ]]
349349
350- if (rlang :: is_symbol(op , c(" +" , " *" , " ~" ))) {
350+ if (is_symbol(op , c(" +" , " *" , " ~" ))) {
351351 c(simplify(a ), simplify(b ))
352- } else if (rlang :: is_symbol(op , " -" )) {
352+ } else if (is_symbol(op , " -" )) {
353353 c(simplify(a ), expr(- !! simplify(b )))
354354 } else {
355355 list (x )
@@ -371,29 +371,29 @@ as_facets <- function(x) {
371371 return (x )
372372 }
373373
374- if (rlang :: is_formula(x )) {
374+ if (is_formula(x )) {
375375 # Use different formula method because plyr's does not handle the
376376 # environment correctly.
377377 f_as_facets(x )
378378 } else {
379379 vars <- as_quoted(x )
380- rlang :: as_quosures(vars , globalenv(), named = TRUE )
380+ as_quosures(vars , globalenv(), named = TRUE )
381381 }
382382}
383383f_as_facets <- function (f ) {
384384 if (is.null(f )) {
385- return (rlang :: as_quosures(list ()))
385+ return (as_quosures(list ()))
386386 }
387387
388- env <- rlang :: f_env(f ) %|| % globalenv()
388+ env <- f_env(f ) %|| % globalenv()
389389
390390 # as.quoted() handles `+` specifications
391391 vars <- as.quoted(f )
392392
393393 # `.` in formulas is ignored
394394 vars <- discard_dots(vars )
395395
396- rlang :: as_quosures(vars , env , named = TRUE )
396+ as_quosures(vars , env , named = TRUE )
397397}
398398discard_dots <- function (x ) {
399399 x [! vapply(x , identical , logical (1 ), as.name(" ." ))]
@@ -406,7 +406,7 @@ is_facets <- function(x) {
406406 if (! length(x )) {
407407 return (FALSE )
408408 }
409- all(vapply(x , rlang :: is_quosure , logical (1 )))
409+ all(vapply(x , is_quosure , logical (1 )))
410410}
411411
412412
@@ -422,8 +422,8 @@ eval_facets <- function(facets, data, env = globalenv()) {
422422 tibble :: as_tibble(vars )
423423}
424424eval_facet <- function (facet , data , env = emptyenv()) {
425- if (rlang :: quo_is_symbol(facet )) {
426- facet <- as.character(rlang :: quo_get_expr(facet ))
425+ if (quo_is_symbol(facet )) {
426+ facet <- as.character(quo_get_expr(facet ))
427427
428428 if (facet %in% names(data )) {
429429 out <- data [[facet ]]
@@ -433,7 +433,7 @@ eval_facet <- function(facet, data, env = emptyenv()) {
433433 return (out )
434434 }
435435
436- rlang :: eval_tidy(facet , data , env )
436+ eval_tidy(facet , data , env )
437437}
438438
439439layout_null <- function () {
0 commit comments