search for: enquos

Displaying 5 results from an estimated 5 matches for "enquos".

Did you mean: en_us
2018 May 03
3
length of `...`
...al n in pre-3.5.0 base R. > > If you don't mind using a package: > > # works with R 3.1 and up > library(rlang) > > x <- "global" > f <- function(...) { > x <- "f" > g(...) > } > g <- function(...) { > dots <- enquos(...) > eval_tidy(dots[[1]]) > } > > f(x, stop("!")) > #> [1] "global" > g(x, stop("!")) > #> [1] "global" > > Hadley > -- Herv? Pag?s Program in Computational Biology Division of Public Health Sciences Fred Hutchin...
2018 May 03
4
length of `...`
On 03/05/2018 11:01 AM, William Dunlap via R-devel wrote: > In R-3.5.0 you can use ...length(): > > f <- function(..., n) ...length() > > f(stop("one"), stop("two"), stop("three"), n=7) > [1] 3 > > Prior to that substitute() is the way to go > > g <- function(..., n) length(substitute(...())) > >
2018 May 03
0
length of `...`
...rest using ..1, > but I don't know a way to do this for general n in pre-3.5.0 base R. If you don't mind using a package: # works with R 3.1 and up library(rlang) x <- "global" f <- function(...) { x <- "f" g(...) } g <- function(...) { dots <- enquos(...) eval_tidy(dots[[1]]) } f(x, stop("!")) #> [1] "global" g(x, stop("!")) #> [1] "global" Hadley -- http://hadley.nz
2018 May 04
0
length of `...`
...>> >> # works with R 3.1 and up >> library(rlang) >> >> x <- "global" >> f <- function(...) { >> x <- "f" >> g(...) >> } >> g <- function(...) { >> dots <- enquos(...) >> eval_tidy(dots[[1]]) >> } >> >> f(x, stop("!")) >> #> [1] "global" >> g(x, stop("!")) >> #> [1] "global" >> >> Hadley >> > -- &gt...
2018 May 04
1
length of `...`
...nd up > >> library(rlang) > >> > >> x <- "global" > >> f <- function(...) { > >> x <- "f" > >> g(...) > >> } > >> g <- function(...) { > >> dots <- enquos(...) > >> eval_tidy(dots[[1]]) > >> } > >> > >> f(x, stop("!")) > >> #> [1] "global" > >> g(x, stop("!")) > >> #> [1] "global" > >> > >>...