Hi,
I think you are looking for this:
y <- factor(x, levels=c("M","F","T"))
If you use the function levels(), you change the labels, but not the
order, so that the first level (previously "F") will now be labeled "M",
the second (previously "M") will now be labeled "F" ,and so on.
This explai
Hi all,
I'm just a beginner in R. I have a pretty basic doubt. This is the actual
quote I wrote
> x<-factor(c("M","F","M","T","M","T"))
> levels(x)=c("M","F","T")
> x
[1] F M F T F T
Levels: M F T
> table(x)
x
M F T
1 3 2
Expectation: I just wanted to change my baselevel from F to M. with the
num
2 matches
Mail list logo