Hello List, I`m trying to make prediction using a bagged tree with the package ipred. I tried to follow the manual but I`m getting an error message. Also browsing through the list-archive I didn`t find any hint. Maybe someone can help me? selbag <- bagging(SOIL_UNIT ~., data=traindat.bin, coob=TRUE) Error in dimnames(X) <- list(dn[[1L]], unlist(collabs, use.names = FALSE)) : length of 'dimnames' [2] not equal to array extent I´m using R 2.7.2 on Win XP and the latest version of ipred. Thanks a lot. TIM ------------------------------------------------------------------------------- Dipl.-Geogr. Tim Häring Sachgebiet Standort und Bodenschutz (SG 2.1) Bayerische Landesanstalt für Wald und Forstwirtschaft Am Hochanger 11 D-85354 Freising Tel.: +49-(0)8161/71-4769 E-Mail: tim.haering@lwf.bayern.de http://www.lwf.bayern.de [[alternative HTML version deleted]]
H?ring, Tim (LWF) wrote:> Hello List, > > > > I`m trying to make prediction using a bagged tree with the package ipred. I tried to follow the manual but I`m getting an error message. Also browsing through the list-archive I didn`t find any hint. > > Maybe someone can help me? > > > > selbag <- bagging(SOIL_UNIT ~., data=traindat.bin, coob=TRUE) > > Error in dimnames(X) <- list(dn[[1L]], unlist(collabs, use.names = FALSE)) : > > length of 'dimnames' [2] not equal to array extent > > > > I?m using R 2.7.2 on Win XP and the latest version of ipred.Please do read the posting guide. - We do not have "traindat.bin", hence cannot reproduce your problem - Does it happen with recent versions of R and ipred? Best, Uwe Ligges> > > Thanks a lot. > > TIM > > > > ------------------------------------------------------------------------------- > > Dipl.-Geogr. Tim H?ring > > Sachgebiet Standort und Bodenschutz (SG 2.1) > > Bayerische Landesanstalt f?r Wald und Forstwirtschaft > > Am Hochanger 11 > > D-85354 Freising > > > > Tel.: +49-(0)8161/71-4769 > > E-Mail: tim.haering at lwf.bayern.de > > http://www.lwf.bayern.de > > > > > > > [[alternative HTML version deleted]] > > > > ------------------------------------------------------------------------ > > ______________________________________________ > R-help at 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.
OK, the information I send to the list were rather sparse. Sorry for that! I just tried the command with the recent Version of R and ipred. The error message is the same. I want to create a classification model. My data consist of 5414 observations and 98 variables whereof 33 are numeric, the remainder are binary nominal (factor) variables. My output SOIL_UNIT is a factor variable with 82 levels. I hope this are enough information to understand the problem. Cheers, TIM -----Ursprüngliche Nachricht----- Von: Uwe Ligges [mailto:ligges@statistik.tu-dortmund.de] Gesendet: Thursday, January 22, 2009 6:49 PM An: Häring, Tim (LWF) Cc: r-help@r-project.org Betreff: Re: [R] dimnames in pkg "ipred" Häring, Tim (LWF) wrote:> Hello List, > > > > I`m trying to make prediction using a bagged tree with the package ipred. I tried to follow the manual but I`m getting an error message. Also browsing through the list-archive I didn`t find any hint. > > Maybe someone can help me? > > > > selbag <- bagging(SOIL_UNIT ~., data=traindat.bin, coob=TRUE) > > Error in dimnames(X) <- list(dn[[1L]], unlist(collabs, use.names = FALSE)) : > > length of 'dimnames' [2] not equal to array extent > > > > I´m using R 2.7.2 on Win XP and the latest version of ipred.Please do read the posting guide. - We do not have "traindat.bin", hence cannot reproduce your problem - Does it happen with recent versions of R and ipred? Best, Uwe Ligges> > > Thanks a lot. > > TIM > > > > ------------------------------------------------------------------------------- > > Dipl.-Geogr. Tim Häring > > Sachgebiet Standort und Bodenschutz (SG 2.1) > > Bayerische Landesanstalt für Wald und Forstwirtschaft > > Am Hochanger 11 > > D-85354 Freising > > > > Tel.: +49-(0)8161/71-4769 > > E-Mail: tim.haering@lwf.bayern.de > > http://www.lwf.bayern.de > > > > > > > [[alternative HTML version deleted]] > > > > ------------------------------------------------------------------------ > > ______________________________________________ > 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.[[alternative HTML version deleted]]
H?ring, Tim (LWF <Tim.Haering <at> lwf.bayern.de> writes:> > OK, the information I send to the list were rather sparse. Sorry for that! > I just tried the command with the recent Version of R and ipred. The errormessage is the same.> I want to create a classification model. My data consist of 5414 observationsand 98 variables whereof 33> are numeric, the remainder are binary nominal (factor) variables. My outputSOIL_UNIT is a factor> variable with 82 levels.No. You should either create a set of dummy data of a similar size that reproduces the problem, or post the data set on a web site: ge = read.table("http://www.menne-biomed.de/gastempt/gastempt.csv", sep=",",header=TRUE) And the code should be complete so that someone can run it with copy/paste. Dieter
I think I solved the problem =) My dataset is an .arff file. So I read my data into R via read.arff. I tried the following: Export the dataframe to an txt-file and import it once again in R via read.table. With the new dataset if works fine. Maybe the error comes from the variable-names. I attached a txt-file containing the str(traindat.bin) output from the data.frame, which I import via read.arff Cheers, TIM -----Urspr?ngliche Nachricht----- Von: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de] Gesendet: Friday, January 23, 2009 11:03 AM An: H?ring, Tim (LWF) Betreff: Re: AW: [R] dimnames in pkg "ipred" H?ring, Tim (LWF) wrote:> OK, the information I send to the list were rather sparse. Sorry for that! > I just tried the command with the recent Version of R and ipred. The error message is the same. > I want to create a classification model. My data consist of 5414 observations and 98 variables whereof 33 are numeric, the remainder are binary nominal (factor) variables. My output SOIL_UNIT is a factor variable with 82 levels. > > I hope this are enough information to understand the problem.What does str(traindat.bin) tell you? Is it a data.frame? Can you reduce the data.frame in a way (less variables and observations) so that you can send the rest by e-mail and we can see the error? Uwe Ligges> Cheers, > TIM > > > > -----Urspr?ngliche Nachricht----- > Von: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de] > Gesendet: Thursday, January 22, 2009 6:49 PM > An: H?ring, Tim (LWF) > Cc: r-help at r-project.org > Betreff: Re: [R] dimnames in pkg "ipred" > > > > H?ring, Tim (LWF) wrote: >> Hello List, >> >> >> >> I`m trying to make prediction using a bagged tree with the package ipred. I tried to follow the manual but I`m getting an error message. Also browsing through the list-archive I didn`t find any hint. >> >> Maybe someone can help me? >> >> >> >> selbag <- bagging(SOIL_UNIT ~., data=traindat.bin, coob=TRUE) >> >> Error in dimnames(X) <- list(dn[[1L]], unlist(collabs, use.names = FALSE)) : >> >> length of 'dimnames' [2] not equal to array extent >> >> >> >> I?m using R 2.7.2 on Win XP and the latest version of ipred. > > > Please do read the posting guide. > > - We do not have "traindat.bin", hence cannot reproduce your problem > - Does it happen with recent versions of R and ipred? > > Best, > Uwe Ligges > > > > >> >> >> Thanks a lot. >> >> TIM >> >> >> >> ------------------------------------------------------------------------------- >> >> Dipl.-Geogr. Tim H?ring >> >> Sachgebiet Standort und Bodenschutz (SG 2.1) >> >> Bayerische Landesanstalt f?r Wald und Forstwirtschaft >> >> Am Hochanger 11 >> >> D-85354 Freising >> >> >> >> Tel.: +49-(0)8161/71-4769 >> >> E-Mail: tim.haering at lwf.bayern.de >> >> http://www.lwf.bayern.de >> >> >> >> >> >> >> [[alternative HTML version deleted]] >> >> >> >> ------------------------------------------------------------------------ >> >> ______________________________________________ >> R-help at 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.-------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: str_traindat.bin.txt URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090123/6c751bd3/attachment-0002.txt>