[R] Is this an artifact of using which?

2008-04-14 Thread Tania Oh
Dear all, I used which to obtain a subset of values from my data.frame. however, I find that there is a trace of the values I have removed. Any suggestions would be greatly appreciate. Below is my data: d - data.frame( val = 1:10, group = sample(LETTERS[1:5], 10,

Re: [R] Is this an artifact of using which?

2008-04-14 Thread Uwe Ligges
Tania Oh wrote: Dear all, I used which to obtain a subset of values from my data.frame. however, I find that there is a trace of the values I have removed. Any suggestions would be greatly appreciate. Below is my data: d - data.frame( val = 1:10, group =

Re: [R] Is this an artifact of using which?

2008-04-14 Thread Tania Oh
Dear Uwe, thank you very much for this. After reading your solution below, I searched the help pages for data.frame, which, factor but I didn't see the option for drop in them. I googled and found drop associated with the function subset. is this the help page you were alluding to? Sorry

Re: [R] Is this an artifact of using which?

2008-04-14 Thread Peter Dalgaard
[EMAIL PROTECTED] wrote: I used which to obtain a subset of values from my data.frame. however, I find that there is a trace of the values I have removed. Any suggestions would be greatly appreciate. Below is my data: d - data.frame( val = 1:10, group =

Re: [R] Is this an artifact of using which?

2008-04-14 Thread Richard . Cotton
The (imho) unintuitive behaviour is to do with the subsetting function [.factor, not which. There are a couple of workarounds: In that case, your intuition needs readjustment There are other systems which (de facto) drop unused levels by default, and it is a real pain to work

Re: [R] Is this an artifact of using which?

2008-04-14 Thread Uwe Ligges
Tania Oh wrote: Dear Uwe, thank you very much for this. After reading your solution below, I searched the help pages for data.frame, which, factor but I didn't see the option for drop in them. In fact, ?factor links to ?[.factor whcih explains it. Uwe I googled and found drop