Hi, Let?s consider aux1. I wanted to order its data considering its first column as the index> aux1[1:4,]V1 V2 V3 V4 V5 V6 1 0.08506724 150 1956 15.08 233.82 463.295 14 2 0.76205323 203 1922 15.35 218.74 463.295 14 3 0.86274890 195 1835 12.54 203.39 463.295 14 4 0.37940715 152 1567 24.73 190.85 463.295 14> aux2 <-- aux1[order(aux1[1:4,1]) , ] > aux2V1 V2 V3 V4 V5 V6 1 -0.08506724 -150 -1956 -15.08 -233.82 -463.295 -14 4 -0.37940715 -152 -1567 -24.73 -190.85 -463.295 -14 2 -0.76205323 -203 -1922 -15.35 -218.74 -463.295 -14 3 -0.86274890 -195 -1835 -12.54 -203.39 -463.295 -14 Why did the result came with a minus sign? Is it a bug? -------------- next part -------------- An HTML attachment was scrubbed... URL: https://stat.ethz.ch/pipermail/r-help/attachments/20000524/ade24d21/attachment.html
"Manuel Castejon Limas" <manuel.castejon at dim.unirioja.es> writes:> > aux2 <-- aux1[order(aux1[1:4,1]) , ] > > aux2 > V1 V2 V3 V4 V5 V6 > 1 -0.08506724 -150 -1956 -15.08 -233.82 -463.295 -14 > 4 -0.37940715 -152 -1567 -24.73 -190.85 -463.295 -14 > 2 -0.76205323 -203 -1922 -15.35 -218.74 -463.295 -14 > 3 -0.86274890 -195 -1835 -12.54 -203.39 -463.295 -14 > > Why did the result came with a minus sign? > > Is it a bug?Only in your code. Try aux2 <- aux1[order(aux1[1:4,1]) , ] -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /''_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
My fault. Sorry for disturbing with such silly thing. Thanks a lot. You have discovered the blind of the list. :-)> Only in your code. Try > > aux2 <- aux1[order(aux1[1:4,1]) , ]-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> Manuel Castejon Limas wrote: > > Hi, > Let?s consider aux1. I wanted to order its data considering its first > column as the index > > > aux1[1:4,] > V1 V2 V3 V4 V5 V6 > 1 0.08506724 150 1956 15.08 233.82 463.295 14 > 2 0.76205323 203 1922 15.35 218.74 463.295 14 > 3 0.86274890 195 1835 12.54 203.39 463.295 14 > 4 0.37940715 152 1567 24.73 190.85 463.295 14 > > > aux2 <-- aux1[order(aux1[1:4,1]) , ] > > aux2 > V1 V2 V3 V4 V5 V6 > 1 -0.08506724 -150 -1956 -15.08 -233.82 -463.295 -14 > 4 -0.37940715 -152 -1567 -24.73 -190.85 -463.295 -14 > 2 -0.76205323 -203 -1922 -15.35 -218.74 -463.295 -14 > 3 -0.86274890 -195 -1835 -12.54 -203.39 -463.295 -14 > Why did the result came with a minus sign? > > Is it a bug?No. You wrote: aux2 <-- aux1[order(aux1[1:4,1]) , ] ^ but this is correct ;-): aux2 <- aux1[order(aux1[1:4,1]) , ] Regards, Uwe Ligges -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._