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
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 -
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
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),
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
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
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