Displaying 20 results from an estimated 9000 matches similar to: "lexicographic sort of ordered lists"
2008 May 12
1
lexicographic comparison of two vectors
Is there any built-in way to lexicographically compare two vectors of
the same length in R? The textbook algorithm could be coded as follows:
lex.cmp <- function (vec1,vec2) {
for (j in 1:length(vec1)) {
if (vec1[j] < vec2[j]) { return(-1) }
if (vec1[j] > vec2[j]) { return(1) }
}
return(0)
}
Thanks,
Gabriel
2003 Aug 12
3
Sorting a dataframe
Undoubtedly a simple question:
I've looked at order() and sort() in the help pages for
R1.7.1. It doesn't appear that these functions are immediately
suited to doing the same thing as
PROC SORT DATA = BLAH;
BY X Y Z;
RUN;
in SAS. I have also checked Frank Harrell's Hmisc library.
Could someone point me in the right direction so I can sort
by the levels of Z within the levels of
2003 Dec 14
5
reverse lexicographic order
Hi all,
I have some email addresses that I would like to sort in reverse
lexicographic order so that addresses from the same domain will be
grouped together. How might that be done?
Murray
--
Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html
Department of Statistics, University of Waikato, Hamilton, New Zealand
Email: maj at waikato.ac.nz
2010 Nov 07
1
How do I order xyplot line points?
I have the following xyplot figure:
http://img577.imageshack.us/img577/686/filesizeresults12000000.png
The data are organized in a matrix file as follows:
Type Elements Chromosome Time
bedGz 12000000 chr1 14.240
bedGz 12000000 chr2 7.949
bedGz 12000000 chr3 5.103
bedGz 12000000 chr4 5.290
bedGz 12000000 chr5 5.161
...
The x-axis labels in the Chromosome column are ordered
2011 Jun 07
1
Sorting a data frame with values of different lengths
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
2013 Jan 24
2
[Bug 9594] New: Error transferring user and non-user xattr using --fake-super under Linux
https://bugzilla.samba.org/show_bug.cgi?id=9594
Summary: Error transferring user and non-user xattr using
--fake-super under Linux
Product: rsync
Version: 3.1.0
Platform: All
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P5
Component: core
AssignedTo: wayned at
2006 Oct 15
3
sort question in a dataset?
Dear friends,
I want to sort a dataset according to one or two variables in the dataset,
i thought sort could do it , but failed.
e.g.
x <- c(2, 9, 18, 3, 2)
y<-c(2,5.6,5,9,8)
z<-c(21,5,5,19,7)
a<-cbind(x,y,z)
a
x y z
[1,] 2 2.0 21
[2,] 9 5.6 5
[3,] 18 5.0 5
[4,] 3 9.0 19
[5,] 2 8.0 7
I want to sort dataset a according to ascending x and descending y, How to
2012 Jul 17
2
order or sort doesn´t work properly
Hi all,
I want to order a series that is included on the second column in MCT.csv.
I do but R doesn?t order, could be because is a csv?
I have prove
MCT<-read.csv("MCT.csv")
a<-order(MCTor[,2],2,decreasing = FALSE)
a<-order(MCTor[,2],1,decreasing = FALSE)
or the same with sort but didn?t worked.
It is suposed that a will have the ordered on ascending or descending
2012 Sep 11
2
Sort or Permutate
Dear all,
I am having a struct that contains on the first column file names and on the second column a number which is a "rating" of the file on first column
A small subset looks like that
small
[,1]
[1,]
2010 Jan 27
2
Merge: sort=F not preserving order?
Hello,
I have the following data1 (index are chars):
?? ?index
1 ?008823
2 ?012689
3 ?004503
4 ?002991
5 ?012689
6 ?002845
7 ?012689
8 ?012395
9 ?012689
10 009302
11 002845
12 006669
13 008823
14 009302
15 025340
16 012689
and data2 in this format (index2 are chars):
?? ? ? index2 ? ? ?tic
1 ? ? 001003 ? ? ANTQ
2 ? ? 001004 ? ? AIR
3 ? ? 001009 ? ? ABSI
4 ? ? 001011 ? ? ACSE
etc
I am
2000 Dec 14
1
Sort in descending order
Hi R users:
I want to know how can I easily sort in descending order a
whole data frame by one or several variables.
Thank you very much for your help.
Kenneth Cabrera
krcabrer at perseus.unalmed.edu.co
krcabrer at epm.net.co
Universidad Nacional de Colombia, Sede Medell?n
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read
2010 Jun 10
2
adding column of ordered numbers to matrix
Hello everyone,
I have a matrix of over 40000 line and about 30 columns.
For my analysis I would like to add another column with ascending numbers
(column header should be "order", and than 1,2,3,4 ....the end of the
matrix).
During my analysis I reorder them ( due to merge commands by a different
column).
How do I add such a column in an ascending order (or descending for what it
2008 Sep 30
1
ordering problem
Hi there!
I need some assistance here with vector orderings. I have a set
of q vectors of length p, grouped by rows in a matrix A, q?p, that I
need to order lexicographically
(http://en.wikipedia.org/wiki/Lexicographical_order).
I also have another matrix B, p?r, and a vector c, that should
be ordered according to the order of A. So far, I was doing
ordering <-
2002 May 06
3
function sort.list()
Derar R-people
I have troubles understanding what the function sort.list() is doing. On
the homepage it says that it returns a permutation which rearranges a
vector into ascending or descending order (like order() but on a vector
instead of a sequence).
> sort.list(c(0, 2, 10, 11, 4))
[1] 1 2 5 3 4
which does not make sense to me.
In fact I am getting the same (non-sensical) result using
2008 Jul 07
2
Sorting a list
Dear R Users,
A bit of a simple question, but I could not find the answer thru google
("sorting lists r cran","how can i sort a list r cran") or RSiteSearch...
how can I sort a list ?
One imagines something like sort.list would do the job, but that's not the
one.
> foo<-list(a=10,b=2,c=3)
> sort.list(foo)
Error in sort.list(foo) : 'x' must be atomic
2009 May 27
3
Sort matrix by column 1 ascending then by column 2 decending
I've got a matrix with 2 columns and n rows. I need to sort it first
by the values in column 1 ascending. Then for values which are the
same in column 1, sort by column 2 decending. For example:
2 .5
1 .3
1 .5
3 .2
Goes to:
1 .5
1 .3
2 .5
3 .2
This is easy to do in spreadsheet programs but I can't seem to work
out how to do it in R and haven't been able to find a solution
anywhere.
2007 Nov 18
1
how to sort a data.frame by ascending some columns
Dear list,
I have a data frame (238304 rows and 6 columns). I want the data frame
sorted by two columns in ascending order. I am showing
the first 5 rows of the data frame
> clones.info[1:5,1:6]
USER_CLONE_ID CHROMOSOME Expr1002 KB_POSITION Allele_A WELL_ID
1 SNP_A-1855402 17 41419603 41419603 C rs17572851
2 SNP_A-4249904 17 41420045 41420045 A rs17572893
3 SNP_A-2174835 18 41407760
2008 Jul 18
1
creating names for lists
Dear R Users,
How can I create names for lists within a function where the name itself
is a function of several variables ?
> a<-1
> b<-2
> paste(a,b)
[1] "1 2"
> foo<-list(paste(a,b)=3) <<<===== DOES NOT WORK
Error: unexpected '=' in "foo<-list(paste(a,b)="
> eval(paste(a,b))
[1] "1 2"
>
2005 Jun 29
2
Sort by docid
Hello,
I wonder if there is a way to cause Xapian to order a result set purely by
docid. In other words, once the result set has been determined, I'd like the
results to be returned to me ordered by their docid, as opposed to by their
match relevance.
The problem at hand is that I'm building a search engine for a mailing list
and I would like to return matches sorted by date; ordering by
2011 Apr 23
1
Arguments to order()
Hi,
The rows of a data frame can be sorted lexicographically as shown in
this example,
my.df <- data.frame(x=c(1,1,1,2,2), y=c(1,2,3,2,1))
my.df[order(my.df$x,my.df$y, decreasing=TRUE), ]
however, I'm wondering if it's possible to pass a variable in as the
first argument to order() so that the actual set of columns used in
the sort can be easily varied?
FWIW, the first argument to