[R] "order" issue

Jim Holtman jholtman at gmail.com
Mon May 24 00:07:24 CEST 2010


do 'str' on your object to see if you have factors where you think you  
have numerics.

What is the problem you are trying to solve?

Sent from my iPhone.

On May 23, 2010, at 17:39, "Zoppoli, Gabriele (NIH/NCI) [G]" <zoppolig at mail.nih.gov 
 > wrote:

> Hi everybody, this is a real dummy thing.
>
> I sorted a matrix based on a given column, and what I get is right,  
> until it comes to columns of negative and positive values; than,  
> "order" orders everything from max to min in the negative values,  
> and then AGAIN from max to min in the positive values!!!
>
> Why isn't everything order from max to min, and that's it?
>
> Thank you!!!
>
> Attached is the txt file I use; try:
>
> x=x[order(x[,2]),]
>
> What I get is:
>
> print(x)
>
>
>          Product A B   Tissue
> 44  ME:MDA_MB_435     -0.1915    -0.16744 Melanoma
> 17     CNS:SNB_75    -0.23183     1.03945      CNS
> 37       LE:K_562    -0.58218      1.8581 Leukemia
> 43    ME:MALME_3M    -0.67327    -1.33493 Melanoma
> 49    ME:UACC_257    -0.72431    -1.84753 Melanoma
> 42         ME:M14    -0.73942    -0.73904 Melanoma
> 40          LE:SR    -0.93541     2.95346 Leukemia
> 25      CO:SW_620    -1.53265    -1.35446    Colon
> 63      RE:CAKI_1    -2.48443     0.43245    Renal
> 39   LE:RPMI_8226    -2.59561     -1.9448 Leukemia
> 26        LC:A549    -2.66221     0.71215     Lung
> 61        RE:A498    -2.89402     0.93287    Renal
> 9       BR:HS578T    -2.94118      1.1217   Breast
> 34    LC:NCI_H522    -2.94381      0.3859     Lung
> 66       RE:TK_10    -2.95281     1.26245    Renal
> 52 OV:NCI_ADR_RES    -3.04456     0.17046  Ovarian
> 57     OV:SK_OV_3    -3.04477     2.15405  Ovarian
> 53     OV:OVCAR_3     -3.0705    -0.31743  Ovarian
> 14     CNS:SF_295    -3.09348    -1.00095      CNS
> 54     OV:OVCAR_4    -3.13137    -0.47497  Ovarian
> 36       LE:HL_60    -3.16745    -3.16745 Leukemia
> 38      LE:MOLT_4    -3.20055    -1.72841 Leukemia
> 11  BR:MDA_MB_231    -3.24907     1.58326   Breast
> 59        PR:PC_3    -3.36612     1.39328 Prostate
> 19     CO:HCT_116    -3.39764     0.43061    Colon
> 12        BR:T47D    -3.41228     1.13818   Breast
> 22      CO:HCT_15    -3.45342     0.16357    Colon
> 64     RE:RXF_393    -3.49615     2.59144    Renal
> 28      LC:HOP_62     -3.4968     0.67884     Lung
> 60       RE:786_0     -3.5086     1.75056    Renal
> 35    LE:CCRF_CEM    -3.54526    -2.09262 Leukemia
> 29      LC:HOP_92    -3.60636     0.87116     Lung
> 21    CO:HCC_2998    -3.61457    -0.32362    Colon
> 13     CNS:SF_268    -3.63916     2.54378      CNS
> 20     CO:COLO205    -3.64656     0.54344    Colon
> 56     OV:OVCAR_8    -3.66053     -0.9594  Ovarian
> 24        CO:KM12    -3.68703     2.19991    Colon
> 55     OV:OVCAR_5     -3.7852     2.43038  Ovarian
> 8       BR:BT_549    -3.80239    -0.43099   Breast
> 15     CNS:SF_539    -3.86184     1.39114      CNS
> 65       RE:SN12C    -3.90776     0.85244    Renal
> 31     LC:NCI_H23    -3.91625    -1.14955     Lung
> 62        RE:ACHN    -3.96246    -0.62365    Renal
> 67       RE:UO_31    -3.99791    -1.09215    Renal
> 10        BR:MCF7    -4.00187     1.46303   Breast
> 51      OV:IGROV1    -4.02758     2.04324  Ovarian
> 23        CO:HT29    -4.11624    -0.02799    Colon
> 41     ME:LOXIMVI     -4.2572     0.37259 Melanoma
> 32   LC:NCI_H322M    -4.28534     1.66783     Lung
> 27        LC:EKVX    -4.32847     1.66042     Lung
> 58      PR:DU_145    -4.33961     1.57548 Prostate
> 30    LC:NCI_H226    -4.37408    -0.22311     Lung
> 33    LC:NCI_H460      0.0042     -0.6023     Lung
> 18       CNS:U251     0.01263     1.66389      CNS
> 16     CNS:SNB_19     0.16583     0.03737      CNS
> 45       ME:MDA_N     0.21077     0.05502 Melanoma
> 50     ME:UACC_62     0.52503      0.1605 Melanoma
> 46    ME:SK_MEL_2     0.55255     -1.6667 Melanoma
> 47   ME:SK_MEL_28      1.7425     1.45266 Melanoma
> 48    ME:SK_MEL_5     1.74749    -1.47817 Melanoma
>
> Gabriele Zoppoli, MD
> Ph.D. Fellow, Experimental and Clinical Oncology and Hematology,  
> University of Genova, Genova, Italy
> Guest Researcher, LMP, NCI, NIH, Bethesda MD
>
> Work: 301-451-8575
> Mobile: 301-204-5642
> Email: zoppolig at mail.nih.gov
> <x.txt>
> ______________________________________________
> 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.



More information about the R-help mailing list