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

Gabor Grothendieck ggrothend|eck @end|ng |rom gm@||@com
Fri Apr 24 13:55:36 CEST 2026


This works:as a workaround:

  c(1,
    2,
    3,
    NULL)
  ## [1] 1 2 3

so now we just insert before the NULL.


On Fri, Apr 24, 2026 at 7:35 AM Manfred Kooistra
<manfred.kooistra using gmail.com> wrote:
>
> 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?
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-devel mailing list