Hi All, Can you tell me why I get the error message below? It's driving me nuts. Thanks, Tom> r_squared[[1]] [1] 0.9083936 [[2]] [1] 0.8871647 [[3]] [1] 0.8193883 [[4]] [1] 0.728157 [[5]] [1] 0.8849525 [[6]] [1] 0.8459416 [[7]] [1] 0.6702318 [[8]] [1] 0.02997816 [[9]] [1] 0.8974268 [[10]] [1] 0.881217 [[11]] [1] 0.8006688 [[12]] [1] 0.7207697 [[13]] [1] 0.8703734 [[14]] [1] 0.8384346 [[15]] [1] 0.6237472> > biggest=c(0,0) > > for (i in 1:15) {+ + if (r_squared[i]>biggest[1]) biggest=c(r_squared[i],i)} Error in r_squared[i] > biggest[1] : comparison of these types is not implemented -- View this message in context: http://n4.nabble.com/comparison-of-these-types-is-not-implemented-tp964195p964195.html Sent from the R help mailing list archive at Nabble.com.
Dear Tom, r_squared is a list of vectors and not a vector. Use r_squared[[i]] instead of r_squared[i] or convert r_squared to a vector with unlist(r_squared) HTH, Thierry ------------------------------------------------------------------------ ---- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biometrics & Quality Assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 Thierry.Onkelinx at inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -----Oorspronkelijk bericht----- Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Namens Tom Pitt Verzonden: dinsdag 15 december 2009 11:30 Aan: r-help at r-project.org Onderwerp: [R] comparison of these types is not implemented Hi All, Can you tell me why I get the error message below? It's driving me nuts. Thanks, Tom> r_squared[[1]] [1] 0.9083936 [[2]] [1] 0.8871647 [[3]] [1] 0.8193883 [[4]] [1] 0.728157 [[5]] [1] 0.8849525 [[6]] [1] 0.8459416 [[7]] [1] 0.6702318 [[8]] [1] 0.02997816 [[9]] [1] 0.8974268 [[10]] [1] 0.881217 [[11]] [1] 0.8006688 [[12]] [1] 0.7207697 [[13]] [1] 0.8703734 [[14]] [1] 0.8384346 [[15]] [1] 0.6237472> > biggest=c(0,0) > > for (i in 1:15) {+ + if (r_squared[i]>biggest[1]) biggest=c(r_squared[i],i)} Error in r_squared[i] > biggest[1] : comparison of these types is not implemented -- View this message in context: http://n4.nabble.com/comparison-of-these-types-is-not-implemented-tp9641 95p964195.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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. Druk dit bericht a.u.b. niet onnodig af. Please do not print this message unnecessarily. Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.
you need: r_squared[[i]] What is the problem you are trying to solve? Sent from my iPhone. On Dec 15, 2009, at 2:29, Tom Pitt <t.pitt at hotmail.com> wrote:> > Hi All, > > Can you tell me why I get the error message below? It's driving me > nuts. > > Thanks, > Tom > >> r_squared > [[1]] > [1] 0.9083936 > > [[2]] > [1] 0.8871647 > > [[3]] > [1] 0.8193883 > > [[4]] > [1] 0.728157 > > [[5]] > [1] 0.8849525 > > [[6]] > [1] 0.8459416 > > [[7]] > [1] 0.6702318 > > [[8]] > [1] 0.02997816 > > [[9]] > [1] 0.8974268 > > [[10]] > [1] 0.881217 > > [[11]] > [1] 0.8006688 > > [[12]] > [1] 0.7207697 > > [[13]] > [1] 0.8703734 > > [[14]] > [1] 0.8384346 > > [[15]] > [1] 0.6237472 > >> >> biggest=c(0,0) >> >> for (i in 1:15) { > + > + if (r_squared[i]>biggest[1]) biggest=c(r_squared[i],i)} > Error in r_squared[i] > biggest[1] : > comparison of these types is not implemented > > > > -- > View this message in context: http://n4.nabble.com/comparison-of-these-types-is-not-implemented-tp964195p964195.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.
Hi you have got some response about how to avoid an error but I am curious what you really want to achieve. lll<-as.list(rnorm(15)) cbind(unlist(lll),order(unlist(lll))) [,1] [,2] [1,] 0.93344282 13 [2,] 0.63501664 14 [3,] 0.05976446 8 [4,] -0.49181944 9 [5,] 2.08002464 7 [6,] 0.53363526 4 [7,] -0.71654312 3 [8,] -1.29946583 11 [9,] -1.08968642 15 [10,] 1.00504020 6 [11,] 0.37454789 12 [12,] 0.63042834 2 [13,] -2.96375833 1 [14,] -1.33535021 10 [15,] 0.52719651 5 unlist(lll)[order(unlist(lll))] [1] -2.96375833 -1.33535021 -1.29946583 -1.08968642 -0.71654312 -0.49181944 [7] 0.05976446 0.37454789 0.52719651 0.53363526 0.63042834 0.63501664 [13] 0.93344282 1.00504020 2.08002464 Is this what you want? Regards Petr r-help-bounces at r-project.org napsal dne 15.12.2009 11:29:58:> > Hi All, > > Can you tell me why I get the error message below? It's driving menuts.> > Thanks, > Tom > > > r_squared > [[1]] > [1] 0.9083936 > > [[2]] > [1] 0.8871647 > > [[3]] > [1] 0.8193883 > > [[4]] > [1] 0.728157 > > [[5]] > [1] 0.8849525 > > [[6]] > [1] 0.8459416 > > [[7]] > [1] 0.6702318 > > [[8]] > [1] 0.02997816 > > [[9]] > [1] 0.8974268 > > [[10]] > [1] 0.881217 > > [[11]] > [1] 0.8006688 > > [[12]] > [1] 0.7207697 > > [[13]] > [1] 0.8703734 > > [[14]] > [1] 0.8384346 > > [[15]] > [1] 0.6237472 > > > > > biggest=c(0,0) > > > > for (i in 1:15) { > + > + if (r_squared[i]>biggest[1]) biggest=c(r_squared[i],i)} > Error in r_squared[i] > biggest[1] : > comparison of these types is not implemented > > > > -- > View this message in context:http://n4.nabble.com/comparison-of-these-types-> is-not-implemented-tp964195p964195.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.