[R] modify the levels of a variable

clee cheelee7 at gmail.com
Wed Mar 10 22:35:35 CET 2010

If anyone can help with this, I would greatly appreciate it.

When I subset a dataframe, and then create a table of on of the column
variables, the levels of that variable are retained from the parent
dataframe.  Anyone know how to 

for example, say I have data like so:

X     Y
a     2
b     2
a     3
b     3
a     5

if I do....


I get the new data frame:

X     Y
a     2
a     3
a     5

but if I do this...


I would get this:

X     Y
3     0

additionally when I write...


I get...
Factors w/ 2 levels: "a", "b"

I want it to be...
Factors w/ 1 level: "a"

Normally I would just move on and won't even bother but I'm working with a
variable that has 204 levels and only 84 of those are meaningful to me.  How
can I reset the levels of a column variable?  help please!  Thanks!
View this message in context: http://n4.nabble.com/modify-the-levels-of-a-variable-tp1588089p1588089.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list