ID: T8dfe471e360ac80264c6c Dear, I'm using R 2.8.1 with the package reshape version 0.8.2 .
It seems that the combine_factor function has problems with combining levels to an empty level: #EXAMPLE WORKING test<-sample(c(1:10),1000,replace=T) testf<-factor(test, c(1:10), LETTERS[1:10]) table(testf,exclude=NULL) testc<-combine_factor(testf, c(1,1,1,1,1,2,2,2,2,2)) levels(testc)<-c("A-E","F-J") table(testc,exclude=NULL) #EXAMPLE NOT WORKING test<-sample(c(1:5),1000,replace=T) testf<-factor(test, c(1:10), LETTERS[1:10]) table(testf,exclude=NULL) testc<-combine_factor(testf, c(1,1,1,1,1,2,2,2,2,2)) #Error in factor(variable[as.numeric(fac)], labels = levels(fac)[!duplicated(variable)]) : # invalid labels; length 2 should be 1 or 1 #EXAMPLE WORKING testc<-combine_factor(testf, c(1,2,1,2,1,2,1,2,1,2)) levels(testc)<-c("A/C/E/G/I","B/D/F/H/J") table(testc,exclude=NULL) How can I solve the problem? Robbie robbie.heremans.4...@police.be ********************************************************************** The Belgian Police in no way guarantees the technical integrity of the content of this message, nor the identity of the sender. If you received this message by mistake, any disclosure, reproduction, copying, distribution, or other dissemination or use of this communication is strictly prohibited. In this case please notify the sender immediately and then delete this message. *********************************************************************** De Belgische Politie kan noch de technische integriteit van de inhoud van dit bericht, noch de identiteit van de afzender garanderen. Als u dit bericht per vergissing ontvangen hebt, dan is elke bekendmaking, reproductie, vorm van copiëren, verdeling of andere verspreiding of gebruik van deze communicatie strikt verboden. Gelieve in dit geval de afzender onmiddellijk te verwittigen en het bericht de verwijderen. *********************************************************************** La Police Belge ne peut garantir ni l'intégrité technique du contenu de ce message, ni l'identité de l'expéditeur. Si, par erreur, vous recevez ce message, toute annonce du contenu, reproduction, copie, distribution ou autre diffusion ou usage de cette communication est strictement interdit. Veuillez dans ce cas avertir immédiatement l'expéditeur et effacer ce message. *********************************************************************** ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.