[R] removing factor values in the main data frame
hoda rahmati
hodarahmati68 at yahoo.com
Tue Mar 1 17:29:09 CET 2016
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 contain just these two countries: submydata=subset(mydata,COUNTRY%in%c("US","AU")) factor(submydata$COUNTRY) but after this when I get str of mydata again I have the same data frame with no changes in COUNTRY, however I want mydata to be like:
$ 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/ 2 levels "","AU","US",..: 8 8 8 8 8 8 8 8 8 8Thanks for any help
[[alternative HTML version deleted]]
More information about the R-help
mailing list