Re: [R] subset(..., drop=TRUE) doesn't seem to work.

2004-06-17 Thread Paul Lemmens
Hoi Peter, --On woensdag 16 juni 2004 17:35 +0200 Peter Dalgaard [EMAIL PROTECTED] wrote: Anyways, the way out is d2 - subset(dd,c==1) ifac - sapply(dd,is.factor) d2[ifac] - lapply(d2[ifac],factor) or d2 - subset(dd,c==1) d2[] - lapply(d2, function(x) if (is.factor(x)) factor(x) else x) My

[R] subset(..., drop=TRUE) doesn't seem to work.

2004-06-16 Thread Paul Lemmens
Hello! If I read ?subset, the workings of the argument drop (to me) seem to imply equivalence of A and B (R 1.9.0): #A dd - data.frame(rt=rnorm(10), c=factor(gl(2,5))) dd - subset(dd, c==1) dd$c - dd$c[, drop=TRUE] table(dd$c) 1 5 #B dd - data.frame(rt=rnorm(10), c=factor(gl(2,5))) dd -

Re: [R] subset(..., drop=TRUE) doesn't seem to work.

2004-06-16 Thread Peter Dalgaard
Paul Lemmens [EMAIL PROTECTED] writes: Hello! If I read ?subset, the workings of the argument drop (to me) seem to imply equivalence of A and B (R 1.9.0): #A dd - data.frame(rt=rnorm(10), c=factor(gl(2,5))) dd - subset(dd, c==1) dd$c - dd$c[, drop=TRUE] table(dd$c) 1 5

Re: [R] subset(..., drop=TRUE) doesn't seem to work.

2004-06-16 Thread Paul Lemmens
Dear Peter, --On woensdag 16 juni 2004 17:06 +0200 Peter Dalgaard [EMAIL PROTECTED] wrote: Paul Lemmens [EMAIL PROTECTED] writes: Hello! If I read ?subset, the workings of the argument drop (to me) seem to imply equivalence of A and B (R 1.9.0): # A dd - data.frame(rt=rnorm(10),

Re: [R] subset(..., drop=TRUE) doesn't seem to work.

2004-06-16 Thread Peter Dalgaard
Paul Lemmens [EMAIL PROTECTED] writes: Could you comment? Looks like a documentation bug. The actual code ends up doing x[r, vars, drop = drop] and [.data.frame will not drop factor levels. I wonder if it ever did... Bottomline: unless I find the time to submit a patch for

Re: [R] subset(..., drop=TRUE) doesn't seem to work.

2004-06-16 Thread Prof Brian Ripley
On Wed, 16 Jun 2004, Paul Lemmens wrote: Dear Peter, --On woensdag 16 juni 2004 17:06 +0200 Peter Dalgaard [EMAIL PROTECTED] wrote: Paul Lemmens [EMAIL PROTECTED] writes: Hello! If I read ?subset, the workings of the argument drop (to me) seem to imply equivalence of A and B

Re: [R] subset(..., drop=TRUE) doesn't seem to work.

2004-06-16 Thread Peter Dalgaard
Prof Brian Ripley [EMAIL PROTECTED] writes: No, AFAIK. It was definitely not documented to last November when that comment was added to ?subset. Bottomline: unless I find the time to submit a patch for '[.data.frame', I'll need to use the more elaborate way of dropping the unused