Displaying 20 results from an estimated 20000 matches similar to: "Arguments to order()"
2003 Jul 18
3
lexicographic sort of ordered lists
Does anyone know how to execute the following sort problem in R? Matrix X
has positive integer entries, and each column has been sorted in ascending
order. The problem is now to order the columns lexicographically. For
instance if the matrix X is
1 2 1 1 2
2 2 3 3 2
3 5 5 4 2
then the result should be
1 1 1 2 2
2 3 3 2 2
3 4 5 2 5
Let ONE be a vector of 1's of length
2010 Feb 06
4
Sorting
Hi,
I have a list of vectors (of varying lengths). I'd like to sort this
list by applying a function to each pair of vectors in the list and
returning information to sorting routine that let's it know which one
is larger.
To solve problems like this in Common Lisp, the sort function accepts
a function as an argument. The arguments to this function are two
elements of the list which is
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
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 <-
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
2013 Nov 17
1
order() function, decreasing=TRUE unexpected behaviour
There appears to be an issue with the decreasing=TRUE option on the order() function that indicates either a bug or perhaps a design flaw (potentially flawed because I would suggest the majority of users would expect different behaviour).
# demonstration of problem:
x <- c(2,1,3,4,5)
order(x)
order(x, decreasing=TRUE)
order(x) correctly reports the order as:
2 1 3 4 5
I expected the result
2006 Jul 28
1
order() 'decreasing =' argument must be typed in full
## While in R v. 2.3.1 (the mid-July patch for Windows)
## on a Windows XP machine, this call to order() works fine...
order(1:10,decreasing = TRUE)
## [1] 10 9 8 7 6 5 4 3 2 1
## ...however, the argument name 'decreasing'
## must be typed in toto (note the missing 'g'
## in the following):
> order(1:10,decreasin = TRUE)
## Error in order(na.last, decreasing, ...) :
2010 Oct 06
2
ggplot2 Pareto plot (Barplot in decreasing frequency)
Hi all
I have a large dataframe with (among others) a categorical variable of 52
levels and would like to create a barplot with the bars ordered in
decreasing frequency of the levels. I belive it is referred to as a pareto
plot.
Consider a subset where I keep only the categorical variable in question.
# Example:
v1 = c("aa", "cc", "bb", "bb",
2003 Aug 18
0
apply and sort vs vectorized order
Dear all,
Trying to solve a problem I had (see thread "putting NAs at the end" )
I've noticed a difference in system time requirements between using apply
and sort (or order)
to order each row or column of a matrix compared to a vectorized function I
wrote.
Using apply is much faster when the number of loops (number of rows or
columns to order) is low BUT
much slower when number of
2003 Oct 16
5
Desirable Properties of a Real Metadata Format
I suggest gzipped XML. Feel free to suggest something that isn't XML if you
dislike it that much.
Anyhow, as a practical matter, Vorbis-style metadata lacks a Really Good Way
to have the same data in multiple languages. Or at least a widely-agreed
upon way. So, howzabout...
<data>
<title xml:lang='en'>Mars, the Bringer of War</title>
<title
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
2008 Jun 21
1
passing arguments to a function problem
Dear R-users,
is there some way how to pass various colnames to the following code for
sorting data.frames?
mydf.ordered<-with(mydf, mydf[order(colname1,colname2, colnameX, decreasing
= TRUE), ])
I was trying something like
Afunction<-function (mydf,colnames,decreasing=T){
mydf.ordered<-with(mydf, mydf[order(colnames, decreasing = decreasing),
])
}
but it didnt work
please
2004 Oct 04
2
AW: constructing specially ordered factor
Hi Dimitris,
thank you for your reply,
> does the following work in your data:
>
> levs <- unique.default(Names)
> factor(Names, levs[order(unique.default(Weights))])
your solution is really shorter, but has two issues to be
meant here:
1. "unique.default" is applied twice, what might
be a bit expensive for strings.
2. your solution brings an implicit
2009 Jun 24
1
order by decerasing 1st variable and increasing 2nd variable
Hello,
I have a data.frame which I would like to sort with the primary key
decreasing while the secondry key is increasing e.g.
x <- data.frame(One=c(1,1,1,2,2,3,4,5),Two=c(2,3,1,2,3,3,3,3))
I would like to order it so it looks like this:
One Two
8 5 3
7 4 3
6 3 3
4 2 2
5 2 3
3 1 1
1 1 2
2 1 3
i.e. primarily decreasing in the 1st column but if there is a
2008 Dec 05
1
Lexical Permutation Algorithm in R
Hi all
Here is a rather naive implementation of the SEPA algorithm for generating lexical permutations:
lexperm3 <- function(x, n=length(x)) {
perms <- list()
k <- 1
perms[[k]] <- x
k <- k + 1
for (y in 1:(factorial(n)-1)) {
i <- n-1
while (x[i] > x[i+1] && i > 0) {
i <- i - 1
}
# i is largest index st x[i] > x[i+1]
j <- n
#
2008 Aug 21
1
order(x,y, decreasing = c(FALSE, TRUE)) - how / elegantly?
I've found the need to compute a version of order(x,y)
where I want the sort order
for *increasing* x and *decresing* y ...
something we could imagine could be provided in the future as
order(x,y, decreasing = c(FALSE, TRUE))
i.e., using a 'vectorized' decreasing argument.
{No, I'm not volunteering right now!}
I've found the following R-level solution and
like to quiz
2017 Jun 22
1
hpc r configure not recognizing zlib
System: Red Hat Enterprise Linux Server release 6.5 (Santiago)
I?ve installed zlib 1.2.11 on the home folder of a Red Hat HPC as part of the process for installing R base 3.4.0.
I get this error even after successful install of zlib
checking for inflateInit2_ in -lz... no
checking whether zlib support suffices... configure: error: zlib library and headers are required
I?ve checked R
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
2010 Oct 06
2
ggplot2 barplot in decreasing frequency
Hi all,
I have a large data frame and would like to make a barplot of a categorical
variable with the bars sorted in order of decreasing frequency.
# Example:
v1 = c(1.2, 1.4, 0.9, 1.0, 1.1, 1.0)
v2 = c("aa", "cc", "bb", "bb", "cc", "bb")
v3 = c(8, 10, 11, 9, 9, 10)
df = data.frame(v1=v1, v2=v2, v3=v3)
# How can I tell ggplot to sort
2007 Aug 06
1
rank in decreasing order
Hi All,
I want to give ranks to elements in a column so I used:
total_list$field1.rank <- rank(total_list$field1,ties.method="min")
But this gives me the rank in increasing order. How do I get the ranks in decreasing order? I know decreasing = FALSE is not a legal argument here.
Thanks.
Jiong
The email message (and any attachments) is for the sole use of the intended recipient(s)