Hi, It looks to me that your data frame is being sorted as text.
What does str(W_table) show? How was W_table created? Your W column appears to not be numeric. Sarah On Tue, Jun 7, 2011 at 9:51 AM, William Armstrong <william.armstr...@noaa.gov> wrote: > Hi all, > > I am attempting to run a script in which I permute my data and run a > Wilcoxon rank sum test on the data 1000 times and compare my original test > statistic to the permuted test statistics to more accurately estimate a > significance level for the trends I am observing. > > In the process of doing this, I need to sort a data frame that measures 3 x > 1001 based on the value of the test statistic (W). I am trying to get the > data in ascending order based on W. My data frame looks something like > this: > >> W_table > pds_gagehandles.i. p W > W mibe 1 746 > 2 mibe 2 870.5 > 3 mibe 3 767 > 4 mibe 4 1066 > 5 mibe 5 885 > 6 mibe 6 931.5 > 7 mibe 7 765 > 8 mibe 8 930 > 9 mibe 9 696.5 > 10 mibe 10 711.5 > 11 mibe 11 1006 > > I am trying to sort it using the command: > W_table[order(W_table$W),], > which is spitting out: > > pds_gagehandles.i. p W > 11 mibe 11 1006 > 4 mibe 4 1066 > 9 mibe 9 696.5 > 10 mibe 10 711.5 > W mibe 1 746 > 7 mibe 7 765 > 3 mibe 3 767 > 2 mibe 2 870.5 > 5 mibe 5 885 > 8 mibe 8 930 > 6 mibe 6 931.5 > > I want this data frame to have the values that are currently the first two > as the last two, i.e. I need it in ascending order. I am thinking that I am > having this problem because W is different lengths and ?order states the > data should be "a sequence of numeric, complex, character or logical > vectors, all of the same length, or a classed R object". Maybe because the > values over 1000 have an extra digit R is seeing them as '100' for some > reason? Does anyone know of another function I can use to accomplish this > task or a way to work around this error? > > Thank you very much, > > Billy > > -- -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ 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.