search for: firstexpr

Displaying 8 results from an estimated 8 matches for "firstexpr".

Did you mean: first_expr
2018 May 03
4
length of `...`
...last of these doesn't quite work, because ... can be passed down through a string of callers. You don't necessarily want to evaluate it in the parent.frame(). For example: x <- "global" f <- function(...) { x <- "f" g(...) } g <- function(...) { firstExpr <- substitute(...())[[1]] c(list(...)[[1]], eval(firstExpr, envir = parent.frame())) } Calling g(x) correctly prints "global" twice, but calling f(x) incorrectly prints [1] "global" "f" You can get the first element of ... without evaluating the rest using ....
2018 May 03
3
length of `...`
...string of callers. You don't necessarily want to evaluate it in >> the parent.frame(). For example: >> >> x <- "global" >> f <- function(...) { >> x <- "f" >> g(...) >> } >> g <- function(...) { >> firstExpr <- substitute(...())[[1]] >> c(list(...)[[1]], eval(firstExpr, envir = parent.frame())) >> } >> >> Calling g(x) correctly prints "global" twice, but calling f(x) incorrectly >> prints >> >> [1] "global" "f" >> >&...
2018 May 03
0
length of `...`
...e ... can be passed down > through a string of callers. You don't necessarily want to evaluate it in > the parent.frame(). For example: > > x <- "global" > f <- function(...) { > x <- "f" > g(...) > } > g <- function(...) { > firstExpr <- substitute(...())[[1]] > c(list(...)[[1]], eval(firstExpr, envir = parent.frame())) > } > > Calling g(x) correctly prints "global" twice, but calling f(x) incorrectly > prints > > [1] "global" "f" > > You can get the first element of...
2018 May 03
0
length of `...`
...an be passed > down through a string of callers. You don't necessarily want to > evaluate it in the parent.frame(). For example: > > x <- "global" > f <- function(...) { > x <- "f" > g(...) > } > g <- function(...) { > firstExpr <- substitute(...())[[1]] > c(list(...)[[1]], eval(firstExpr, envir = parent.frame())) > } > > Calling g(x) correctly prints "global" twice, but calling f(x) > incorrectly prints > > [1] "global" "f" > > You can get the first elemen...
2018 May 03
2
length of `...`
...ring of callers. You don't necessarily want to >> evaluate it in the parent.frame(). For example: >> >> x <- "global" >> f <- function(...) { >> x <- "f" >> g(...) >> } >> g <- function(...) { >> firstExpr <- substitute(...())[[1]] >> c(list(...)[[1]], eval(firstExpr, envir = parent.frame())) >> } >> >> Calling g(x) correctly prints "global" twice, but calling f(x) >> incorrectly prints >> >> [1] "global" "f" >> >...
2018 May 04
0
length of `...`
...it in >>> the parent.frame(). For example: >>> >>> x <- "global" >>> f <- function(...) { >>> x <- "f" >>> g(...) >>> } >>> g <- function(...) { >>> firstExpr <- substitute(...())[[1]] >>> c(list(...)[[1]], eval(firstExpr, envir = parent.frame())) >>> } >>> >>> Calling g(x) correctly prints "global" twice, but calling f(x) incorrectly >>> prints >>> >>&...
2018 May 04
1
length of `...`
...(). For example: > >>> > >>> x <- "global" > >>> f <- function(...) { > >>> x <- "f" > >>> g(...) > >>> } > >>> g <- function(...) { > >>> firstExpr <- substitute(...())[[1]] > >>> c(list(...)[[1]], eval(firstExpr, envir = parent.frame())) > >>> } > >>> > >>> Calling g(x) correctly prints "global" twice, but calling f(x) > incorrectly > >>> prints &g...
2018 May 03
7
length of `...`
Hi, In some cases the number of arguments passed as ... must be determined inside a function, without evaluating the arguments themselves. I use the following construct: dotlength <- function(...) length(substitute(expression(...))) - 1L # Usage (returns 3): dotlength(1, 4, something = undefined) How can I define a method for length() which could be called directly on `...`? Or is it an