[Rd] Parser bug? A comma too much.

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Fri Sep 16 16:56:29 CEST 2022


Hello,

Duncan is right, his example convince me. With a function like `[` it's 
frequent to have the second argument missing.

So, no error. Thanks to Avraham, Bill and Duncan.

Hope this helps,

Rui Barradas


Às 15:48 de 16/09/2022, Duncan Murdoch escreveu:
> On 16/09/2022 10:33 a.m., Rui Barradas wrote:
>> Hello,
>>
>> Why doesn't the comma throw an error?
>>
>>
>> plot(1:5,)    # works, no complaints
> 
> That says the second argument is missing.
> 
> You need this to enter missing arguments with positional matching, e.g.
> 
> f(a, , b)
> 
> sets the second argument of f() to missing, but the third is set to b.
> 
> Duncan Murdoch
> 
>>
>>
>> Shouldn't this be considered a bug? I would expect the parser to at
>> least give a warning.
>>
>>
>> sessionInfo()
>> R version 4.2.1 (2022-06-23 ucrt)
>> Platform: x86_64-w64-mingw32/x64 (64-bit)
>> Running under: Windows 10 x64 (build 22000)
>>
>> Matrix products: default
>>
>> locale:
>> [1] LC_COLLATE=Portuguese_Portugal.utf8
>> LC_CTYPE=Portuguese_Portugal.utf8
>> [3] LC_MONETARY=Portuguese_Portugal.utf8 LC_NUMERIC=C
>>
>> [5] LC_TIME=Portuguese_Portugal.utf8
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> loaded via a namespace (and not attached):
>> [1] compiler_4.2.1
>>
>>
>> Rui Barradas
>>
>> ______________________________________________
>> R-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>



More information about the R-devel mailing list