Re: [R] removing factor values in the main data frame

2016-03-01 Thread peter dalgaard
> On 01 Mar 2016, at 18:33 , David L Carlson wrote: > > You need to learn how to send emails in plain text since html gets mangled on > r-help. See your message below. If I understand your question, it has to do > with what happens to factor levels when you subset your data. Subsetting a > fa

Re: [R] removing factor values in the main data frame

2016-03-01 Thread Ulrik Stervbo
Without more information it is hard to see where things go wrong. To judge from your text, I am not sure you do things correct. You are doing it along the lines of: str(mydata) submydata <- subset(mydata, ... ) submydata <- droplevels(submydata) str(submydata) right? On Tue, 1 Mar 2016 at 17:45

Re: [R] removing factor values in the main data frame

2016-03-01 Thread Ulrik Stervbo
Hi, I think droplevels(df) is what you are looking for. Best wishes, Ulrik On Tue, 1 Mar 2016 at 17:33 hoda rahmati via R-help wrote: > Hi all,I have the following main data frame:(mydata)$ TE : num 40 > 40 20 20 20 20 20 20 20 40 ...$ TR : num 49 49 28 28 28 28 28 28 28 > 49 .

Re: [R] removing factor values in the main data frame

2016-03-01 Thread hoda rahmati via R-help
I also tried droplevels but after getting str(submydata) again I see no changes in COUNTRY  On Tuesday, March 1, 2016 8:38 AM, Ulrik Stervbo wrote: Hi, I think droplevels(df) is what you are looking for. Best wishes, Ulrik On Tue, 1 Mar 2016 at 17:33 hoda rahmati via R-help wrote:

[R] removing factor values in the main data frame

2016-03-01 Thread hoda rahmati via R-help
Hi all,I have the following main data frame:(mydata)        $ TE : num 40 40 20 20 20 20 20 20 20 40 ...        $ TR : num 49 49 28 28 28 28 28 28 28 49 ...        $ COUNTRY : Factor w/ 27 levels "","AU","BA","BE",..: 8 8 8 8 8 ...among the COUNTRY I just need US and AU,first I get a subset to c