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
Sorry I should have mentioned: platform i386-apple-darwin8.7.1 arch i386 os darwin8.7.1 system i386, darwin8.7.1 status beta major 2 minor 4.0 year 2006 month 09 day 20 svn rev 39433 language R version.string R version 2.4.0 beta (2006-09-20 r39433) On 9/29/06, hadley wickham <h.wickham at 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 >
Gabor Grothendieck
2006-Sep-29 16:50 UTC
[Rd] Warning: a final empty element has been omitted
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 at 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 at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >
Reasonably Related Threads
- Control statements with condition with greater than one should give error (not just warning) [PATCH]
- Control statements with condition with greater than one should give error (not just warning) [PATCH]
- Data frame printing buglet when multiple empty column names
- request: How can we ignore a component of list having no element
- Finding the first value without warning in a loop