Re: [Rd] Warning: a final empty element has been omitted

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Fri 29 Sep 2006 - 16:50:37 GMT

Here is a kludge:

List <- function(...) {

	mc <- match.call()
	mc <- mc[as.list(mc) != ""]
	mc[[1]] <- as.name("list")
	eval(mc, parent.frame())

}

List(1,2,3,)

On 9/29/06, hadley wickham <h.wickham@gmail.com> wrote:
> How can I suppress this warning?
>
> > options(warn = -10)
> > list(1,2,3,)
> Warning: a final empty element has been omitted
> the part of the args list of 'list' being evaluated was:
> (1, 2, 3, )
> [[1]]
> [1] 1
>
> [[2]]
> [1] 2
>
> [[3]]
> [1] 3
>
> > suppressWarnings(list(1,))
> Warning: a final empty element has been omitted
> the part of the args list of 'list' being evaluated was:
> (1, )
> [[1]]
> [1] 1
>
>
> And can anyone add some insight as to why this warning was added? It
> was nice to be able to use a construction like:
>
> a <- list(
> b = 3,
> c = 4,
> )
>
> so when you added a new line, you could just copy and paste an existing line.
>
> Hadley
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat Sep 30 02:56:28 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 29 Sep 2006 - 17:30:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.