Displaying 1 result from an estimated 1 matches for "containsduplicates".
2007 May 30
1
Factor function: odd behavior when labels argument contains duplicates?
Hi all.
I think it would be nice to be able to combine levels of a factor on
creation a la
x <- rep(0:5,5)
y <- factor(x,levels=0:5,labels=c('1','1',2:5)) ## (1)
y
[1] 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5
Levels: 1 1 2 3 4 5
I thougt this would (should?) create a factor with 5 levels, ie
combining 0 and 1 in x into one level in y.
I find it