> #sort the data by predicted probability > b.order<-bo.id.pred[(order(-predict)),] > b.order[1:20,]gene_id predict 43 637882902 0.07823997 53 638101634 0.66256490 61 639084581 0.08587504 41 637832824 0.02461066 25 637261662 0.11613879 22 637240022 0.06350477 62 639084582 0.02238538 63 639097718 0.06792841 44 637943079 0.04532625 80 640158389 0.06582658 3 637006517 0.57648451 49 638072100 0.01391633 4 637007046 0.08999928 13 637047086 0.01493464 74 639787397 0.01283783 58 638936569 0.29182988 24 637261661 0.02561841 59 639006028 0.31732711 38 637585227 0.31272531 35 637399473 0.10687524 HI, Dear R community, I am sorting the data set bo.id.pred by variable predict, why it does not work? The sequence changed compared with original data set, but you can not read any descending pattern. Thanks! -- Sincerely, Changbin -- [[alternative HTML version deleted]]
On May 5, 2010, at 12:31 PM, Changbin Du wrote:>> #sort the data by predicted probability >> b.order<-bo.id.pred[(order(-predict)),] >> b.order[1:20,] > gene_id predict > 43 637882902 0.07823997 > 53 638101634 0.66256490 > 61 639084581 0.08587504 > 41 637832824 0.02461066 > 25 637261662 0.11613879 > 22 637240022 0.06350477 > 62 639084582 0.02238538 > 63 639097718 0.06792841 > 44 637943079 0.04532625 > 80 640158389 0.06582658 > 3 637006517 0.57648451 > 49 638072100 0.01391633 > 4 637007046 0.08999928 > 13 637047086 0.01493464 > 74 639787397 0.01283783 > 58 638936569 0.29182988 > 24 637261661 0.02561841 > 59 639006028 0.31732711 > 38 637585227 0.31272531 > 35 637399473 0.10687524 > > > > HI, Dear R community, > > I am sorting the data set bo.id.pred by variable predict, why it > does not > work?Because "predict" is not the right object name for a column within a data.frame.> The sequence changed compared with original data set, but you can not > read any descending pattern. > > Thanks! > > -- > Sincerely, > Changbin > -- > > [[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.David Winsemius, MD West Hartford, CT
Works fine for me:> xgene_id predict 43 637882902 0.07823997 53 638101634 0.66256490 61 639084581 0.08587504 41 637832824 0.02461066 25 637261662 0.11613879 22 637240022 0.06350477 62 639084582 0.02238538 63 639097718 0.06792841 44 637943079 0.04532625 80 640158389 0.06582658 3 637006517 0.57648451 49 638072100 0.01391633 4 637007046 0.08999928 13 637047086 0.01493464 74 639787397 0.01283783 58 638936569 0.29182988 24 637261661 0.02561841 59 639006028 0.31732711 38 637585227 0.31272531 35 637399473 0.10687524> x[order(-x$predict),]gene_id predict 53 638101634 0.66256490 3 637006517 0.57648451 59 639006028 0.31732711 38 637585227 0.31272531 58 638936569 0.29182988 25 637261662 0.11613879 35 637399473 0.10687524 4 637007046 0.08999928 61 639084581 0.08587504 43 637882902 0.07823997 63 639097718 0.06792841 80 640158389 0.06582658 22 637240022 0.06350477 44 637943079 0.04532625 24 637261661 0.02561841 41 637832824 0.02461066 62 639084582 0.02238538 13 637047086 0.01493464 49 638072100 0.01391633 74 639787397 0.01283783>I would check your data. Do 'str()' on the data. On Wed, May 5, 2010 at 12:31 PM, Changbin Du <changbind@gmail.com> wrote:> > #sort the data by predicted probability > > b.order<-bo.id.pred[(order(-predict)),] > > b.order[1:20,] > gene_id predict > 43 637882902 0.07823997 > 53 638101634 0.66256490 > 61 639084581 0.08587504 > 41 637832824 0.02461066 > 25 637261662 0.11613879 > 22 637240022 0.06350477 > 62 639084582 0.02238538 > 63 639097718 0.06792841 > 44 637943079 0.04532625 > 80 640158389 0.06582658 > 3 637006517 0.57648451 > 49 638072100 0.01391633 > 4 637007046 0.08999928 > 13 637047086 0.01493464 > 74 639787397 0.01283783 > 58 638936569 0.29182988 > 24 637261661 0.02561841 > 59 639006028 0.31732711 > 38 637585227 0.31272531 > 35 637399473 0.10687524 > > > > HI, Dear R community, > > I am sorting the data set bo.id.pred by variable predict, why it does not > work? The sequence changed compared with original data set, but you can > not > read any descending pattern. > > Thanks! > > -- > Sincerely, > Changbin > -- > > [[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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]]
Yes, Phil! You are right, I forgot put the bo.id.pred$ ahead of predict. Thanks! On Wed, May 5, 2010 at 9:48 AM, Phil Spector <spector@stat.berkeley.edu>wrote:> Changbin - > Perhaps you meant > > b.order = bo.id.pred[order(bo.id.pred$predict,decreasing=TRUE),] > > - Phil Spector > Statistical Computing Facility > Department of Statistics > UC Berkeley > spector@stat.berkeley.edu > > > On Wed, 5 May 2010, Changbin Du wrote: > > #sort the data by predicted probability >>> b.order<-bo.id.pred[(order(-predict)),] >>> b.order[1:20,] >>> >> gene_id predict >> 43 637882902 0.07823997 >> 53 638101634 0.66256490 >> 61 639084581 0.08587504 >> 41 637832824 0.02461066 >> 25 637261662 0.11613879 >> 22 637240022 0.06350477 >> 62 639084582 0.02238538 >> 63 639097718 0.06792841 >> 44 637943079 0.04532625 >> 80 640158389 0.06582658 >> 3 637006517 0.57648451 >> 49 638072100 0.01391633 >> 4 637007046 0.08999928 >> 13 637047086 0.01493464 >> 74 639787397 0.01283783 >> 58 638936569 0.29182988 >> 24 637261661 0.02561841 >> 59 639006028 0.31732711 >> 38 637585227 0.31272531 >> 35 637399473 0.10687524 >> >> >> >> HI, Dear R community, >> >> I am sorting the data set bo.id.pred by variable predict, why it does not >> work? The sequence changed compared with original data set, but you can >> not >> read any descending pattern. >> >> Thanks! >> >> -- >> Sincerely, >> Changbin >> -- >> >> [[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. >> >>-- Sincerely, Changbin -- Changbin Du DOE Joint Genome Institute Bldg 400 Rm 457 2800 Mitchell Dr Walnut Creet, CA 94598 Phone: 925-927-2856 [[alternative HTML version deleted]]