[Rd] Feature request: Allow comma after last element in a list

Manfred Kooistra m@n|red@koo|@tr@ @end|ng |rom gm@||@com
Fri Apr 24 11:08:40 CEST 2026


I've always been irritated that R doesn't allow a comma after the last element in a "list":

> a <- c(
+     1,
+     2,
+     3
+ )
> a
[1] 1 2 3
> b <- c(
+     1,
+     2,
+     3,
+ )
Error in c(1, 2, 3, ) : argument 4 is empty

This makes updating lists unnecessarily cumbersome, which I find I frequently do, either when I test code and want to run it with lists of varying elements or varying orders of elements or when I maintain lists manually over time and have to add or delete elements from them.

Is there a reason for this behavior in R and might it not be a good idea to change it?


More information about the R-devel mailing list