Displaying 9 results from an estimated 9 matches for "nthexpr".
Did you mean:
nther
2018 May 03
4
length of `...`
...<- function(..., n) ...elt(n)
> > fn(stop("one"), 3*5, stop("three"), n=2)
> [1] 15
>
> Prior to 3.5.0, eval the appropriate component of the output
> of substitute() in the appropriate environment:
> > gn <- function(..., n) {
> + nthExpr <- substitute(...())[[n]]
> + eval(nthExpr, envir=parent.frame())
> + }
> > gn(stop("one"), environment(), stop("two"), n=2)
> <environment: R_GlobalEnv>
>
Bill, the last of these doesn't quite work, because ... can be passed
down...
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
2018 May 03
3
length of `...`
...top("one"), 3*5, stop("three"), n=2)
>>> [1] 15
>>>
>>> Prior to 3.5.0, eval the appropriate component of the output
>>> of substitute() in the appropriate environment:
>>> > gn <- function(..., n) {
>>> + nthExpr <- substitute(...())[[n]]
>>> + eval(nthExpr, envir=parent.frame())
>>> + }
>>> > gn(stop("one"), environment(), stop("two"), n=2)
>>> <environment: R_GlobalEnv>
>>>
>>
>> Bill, the last of th...
2018 May 03
0
length of `...`
...ating the
other ... entries.
> fn <- function(..., n) ...elt(n)
> fn(stop("one"), 3*5, stop("three"), n=2)
[1] 15
Prior to 3.5.0, eval the appropriate component of the output
of substitute() in the appropriate environment:
> gn <- function(..., n) {
+ nthExpr <- substitute(...())[[n]]
+ eval(nthExpr, envir=parent.frame())
+ }
> gn(stop("one"), environment(), stop("two"), n=2)
<environment: R_GlobalEnv>
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, May 3, 2018 at 7:29 AM, D?nes T?th <toth.denes at...
2018 May 03
0
length of `...`
...lt(n)
>> > fn(stop("one"), 3*5, stop("three"), n=2)
>> [1] 15
>>
>> Prior to 3.5.0, eval the appropriate component of the output
>> of substitute() in the appropriate environment:
>> > gn <- function(..., n) {
>> + nthExpr <- substitute(...())[[n]]
>> + eval(nthExpr, envir=parent.frame())
>> + }
>> > gn(stop("one"), environment(), stop("two"), n=2)
>> <environment: R_GlobalEnv>
>>
>
> Bill, the last of these doesn't quite work, beca...
2018 May 03
0
length of `...`
...)
>> > fn(stop("one"), 3*5, stop("three"), n=2)
>> [1] 15
>>
>> Prior to 3.5.0, eval the appropriate component of the output
>> of substitute() in the appropriate environment:
>> > gn <- function(..., n) {
>> + nthExpr <- substitute(...())[[n]]
>> + eval(nthExpr, envir=parent.frame())
>> + }
>> > gn(stop("one"), environment(), stop("two"), n=2)
>> <environment: R_GlobalEnv>
>>
>
> Bill, the last of these doesn't quite work,...
2018 May 03
2
length of `...`
...top("one"), 3*5, stop("three"), n=2)
>>> [1] 15
>>>
>>> Prior to 3.5.0, eval the appropriate component of the output
>>> of substitute() in the appropriate environment:
>>> > gn <- function(..., n) {
>>> + nthExpr <- substitute(...())[[n]]
>>> + eval(nthExpr, envir=parent.frame())
>>> + }
>>> > gn(stop("one"), environment(), stop("two"), n=2)
>>> <environment: R_GlobalEnv>
>>>
>>
>> Bill, the last of th...
2018 May 04
0
length of `...`
...;three"), n=2)
>>>> [1] 15
>>>>
>>>> Prior to 3.5.0, eval the appropriate component of the output
>>>> of substitute() in the appropriate environment:
>>>> > gn <- function(..., n) {
>>>> + nthExpr <- substitute(...())[[n]]
>>>> + eval(nthExpr, envir=parent.frame())
>>>> + }
>>>> > gn(stop("one"), environment(), stop("two"), n=2)
>>>> <environment: R_GlobalEnv>
>>>>
>>&...
2018 May 04
1
length of `...`
...>>>> [1] 15
> >>>>
> >>>> Prior to 3.5.0, eval the appropriate component of the output
> >>>> of substitute() in the appropriate environment:
> >>>> > gn <- function(..., n) {
> >>>> + nthExpr <- substitute(...())[[n]]
> >>>> + eval(nthExpr, envir=parent.frame())
> >>>> + }
> >>>> > gn(stop("one"), environment(), stop("two"), n=2)
> >>>> <environment: R_GlobalEnv>
> >&g...