/usr/lib/R/site-library/dplyr/doc/compatibility.R is in r-cran-dplyr 0.7.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | ## ----setup, include = FALSE----------------------------------------------
library(dplyr)
knitr::opts_chunk$set(collapse = T, comment = "#>")
## ---- results = "hide"---------------------------------------------------
if (utils::packageVersion("dplyr") > "0.5.0") {
# code for new version
} else {
# code for old version
}
## ---- eval = FALSE-------------------------------------------------------
# if (utils::packageVersion("dplyr") > "0.5.0") {
# dbplyr::build_sql(...)
# } else {
# dplyr::build_sql(...)
# }
## ------------------------------------------------------------------------
#' @rawNamespace
#' if (utils::packageVersion("dplyr") > "0.5.0") {
#' importFrom("dbplyr", "build_sql")
#' } else {
#' importFrom("dplyr", "build_sql")
#' }
## ---- eval = FALSE-------------------------------------------------------
# wrap_dbplyr_obj("build_sql")
#
# wrap_dbplyr_obj("base_agg")
## ---- eval = FALSE-------------------------------------------------------
# quo <- quo(cyl)
# select(mtcars, !! quo)
## ---- results = "hide"---------------------------------------------------
sym <- quote(cyl)
select(mtcars, !! sym)
call <- quote(mean(cyl))
summarise(mtcars, !! call)
## ------------------------------------------------------------------------
quo(!! sym)
quo(!! call)
rlang::as_quosure(sym)
rlang::as_quosure(call)
## ------------------------------------------------------------------------
f <- ~cyl
f
rlang::as_quosure(f)
## ------------------------------------------------------------------------
rlang::sym("cyl")
rlang::syms(letters[1:3])
## ------------------------------------------------------------------------
syms <- rlang::syms(c("foo", "bar", "baz"))
quo(my_call(!!! syms))
fun <- rlang::sym("my_call")
quo(UQ(fun)(!!! syms))
## ------------------------------------------------------------------------
call <- rlang::lang("my_call", !!! syms)
call
rlang::as_quosure(call)
# Or equivalently:
quo(!! rlang::lang("my_call", !!! syms))
## ---- eval=FALSE---------------------------------------------------------
# lazyeval::interp(~ mean(var), var = rlang::sym("mpg"))
## ---- eval=FALSE---------------------------------------------------------
# var <- "mpg"
# quo(mean(!! rlang::sym(var)))
## ---- eval = FALSE-------------------------------------------------------
# filter_.tbl_df <- function(.data, ..., .dots = list()) {
# dots <- compat_lazy_dots(.dots, caller_env(), ...)
# filter(.data, !!! dots)
# }
## ---- eval = FALSE-------------------------------------------------------
# filter.default <- function(.data, ...) {
# filter_(.data, .dots = compat_as_lazy_dots(...))
# }
## ---- eval = FALSE-------------------------------------------------------
# filter.sf <- function(.data, ...) {
# st_as_sf(NextMethod())
# }
## ---- eval = FALSE-------------------------------------------------------
# mutate_each(starwars, funs(as.character))
# mutate_all(starwars, funs(as.character))
## ---- eval = FALSE-------------------------------------------------------
# mutate_all(starwars, as.character)
## ---- eval = FALSE-------------------------------------------------------
# mutate_each(starwars, funs(as.character), height, mass)
# mutate_at(starwars, vars(height, mass), as.character)
## ---- eval = FALSE-------------------------------------------------------
# summarise_at(mtcars, vars(starts_with("d")), mean)
## ---- eval = FALSE-------------------------------------------------------
# mutate_at(starwars, c("height", "mass"), as.character)
|