[Rd] Ellipsis and dot-dot-number [Re: Dots are not fixed by make.names()]

Kirill Müller kr|m|r+m| @end|ng |rom m@||box@org
Fri Mar 8 22:26:17 CET 2019


Hi


In addition to the inconsistency in make.names(), the text in ?Reserved 
seems incomplete:

"Reserved words outside quotes are always parsed to be references to the 
objects linked to in the ‘Description’, and hence they are not allowed 
as syntactic names (see make.names). They **are** allowed as 
non-syntactic names, e.g. inside backtick quotes."

`..1` and `...` are allowed for assigning, but these symbols cannot be 
used in the context of a variable. Example:

`..1` <- 1
`..13` <- 13
`...` <- "dots"
`..1`
#> Error: ..1 used in an incorrect context, no ... to look in
`..13`
#> Error: ..13 used in an incorrect context, no ... to look in
`...`
#> Error in eval(expr, envir, enclos): '...' used in an incorrect context

Does the ?Reserved help page need to mention this oddity, or link to 
more detailed documentation?


Best regards

Kirill


On 05.10.18 11:27, Kirill Müller wrote:
> Hi
>
>
> It seems that names of the form "..#" and "..." are not fixed by 
> make.names(), even though they are reserved words. The documentation 
> reads:
>
> > [...] Names such as ".2way" are not valid, and neither are the 
> reserved words.
>
> > Reserved words in R: [...] ... and ..1, ..2 etc, which are used to 
> refer to arguments passed down from a calling function, see ?... .
>
> I have pasted a reproducible example below.
>
> I'd like to suggest to convert these to "...#" and "....", 
> respectively. Happy to contribute PR.
>
>
> Best regards
>
> Kirill
>
>
> make.names(c("..1", "..13", "..."))
> #> [1] "..1"  "..13" "..."
> `..1` <- 1
> `..13` <- 13
> `...` <- "dots"
>
> mget(c("..1", "..13", "..."))
> #> $..1
> #> [1] 1
> #>
> #> $..13
> #> [1] 13
> #>
> #> $...
> #> [1] "dots"
> `..1`
> #> Error in eval(expr, envir, enclos): the ... list does not contain 
> any elements
> `..13`
> #> Error in eval(expr, envir, enclos): the ... list does not contain 
> 13 elements
> `...`
> #> Error in eval(expr, envir, enclos): '...' used in an incorrect context
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list