[R] How to change levels?
paladini
paladini at beuth-hochschule.de
Wed Jan 16 10:56:26 CET 2013
Hello!
I have got a dataframe with 10 columns and 100 rows. The seventh column
consists of a lot of country names.
When I use newdata=subset(data, data[, 7]=="United Kingdom"|data[,
7]=="Germany") I get just the rows where the country name is UK or
Germany.
But the level information doesn`t change. That means if I use
levels(newdata[,7]), I get:
[1] "Austria" "Belgium"
[3] "Denmark" "Finland"
[5] "France" "Germany"
[7] "Spain" "Sweden"
[9] "Switzerland" "The Netherlands"
[11] "United Kingdom" "United States of America"
That leads to problems in the further data processing .
How can I change the level information to the real levels of newdata?
Thanking you in anticipation
Claudia
More information about the R-help
mailing list