Re: [R] Variable passed to function not used in function in select=... in subset

From: Wacek Kusnierczyk <>
Date: Tue, 11 Nov 2008 09:49:31 +0100

Gabor Grothendieck wrote:
> Regarding the convenience it occurs in expressions like this:
> iris2 <- subset(iris, select = - Species)
> to create a data frame without the Species column.

aha! so what's you best guess about the result here:

d = data.frame(a = 1)
d$`-b` = 2
# here we go

subset(d, select = -b)
# to b or not to b?

b = "a"
subset(d, select = -b)
# tragedy

d$b = 3
subset(d, select = -b)
# catharsis

(for whatever reason a user may choose to have a column named '-b')

vQ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 11 Nov 2008 - 08:53:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 11 Nov 2008 - 10:30:23 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive