Displaying 1 result from an estimated 1 matches for "birthmark".
2013 Dec 14
2
Change factor levels
...;- data.frame(cbind(x = 1, y = 1:10), fac = sample(L3, 10, replace
= TRUE))
(d <- d0[d0$fac %in% c('A', 'B'),])
x y fac
2 1 2 B
3 1 3 A
4 1 4 A
5 1 5 A
6 1 6 B
8 1 8 A
Even though factor 'fac' in 'd' only has 2 levels, but it seems to bear the
birthmark of 3 levels from its parent 'd0':
str(d)
'data.frame': 6 obs. of 3 variables:
$ x : num 1 1 1 1 1 1
$ y : num 2 3 4 5 6 8
$ fac: Factor w/ 3 levels "A","B","C": 2 1 1 1 2 1
How can I cut the umbilical cord so that factor 'fac' in '...