search for: myrank

Displaying 5 results from an estimated 5 matches for "myrank".

Did you mean: myrand
2006 Oct 10
1
How to assign a rank to a range of values..
>From the following: basin.map <- readAsciiGrid("c:/temp/area.asc", colname="area") I have a SpatialGridDataFrame which has the x and y cordinate of a cell, and the drainage area of that cell. There are many cells with a low drainage area (in my case, 33000 with an area of 37.16) and one cell with the highest drainage area (again, in my case, a drainage area of of
2018 Mar 12
1
Equivalent of gtools::mixedsort in R base
...; ) DF <- expand.grid( x = x, y = y ) # randomize set.seed( 42 ) DF <- DF[ sample( nrow( DF ) ), ] # missing from gtools mixedrank <- function( x ) { seq.int( length( x ) )[ gtools::mixedorder(x) ] } o <- do.call( order, lapply( DF, mixedrank ) ) DF[ o, ] # or, as Bert suggests: myrank <- function( v ) { vu <- unique(v) vl <- regmatches( vu,regexec("^([A-Za-z]+)(\\d+)$",vu)) alph <- sapply( vl, function(s) s[2] ) digt <- as.integer( sapply( vl, function(s) s[3] ) ) o <- order( alph, digt ) vo <- ordered( v, levels=vu[ o ] ) } o2 &...
2018 Mar 12
0
Equivalent of gtools::mixedsort in R base
??? > y <- sort( c("a1","a2","a10","a12","a100")) > y [1] "a1" "a10" "a100" "a12" "a2" > mixedsort(y) [1] "a1" "a2" "a10" "a12" "a100" **Please read the docs!** They say that mixedsort() and mixedorder() both take a **single
2018 Mar 12
7
Equivalent of gtools::mixedsort in R base
Hi, Searching for functions that would order strings that mix characters and numbers in a "natural" way (ie, "a1 a2 a10" instead of "a1 a10 a2"), I found the mixedsort and mixedorder from the gtools package. Problems: 1- mixedorder does not work in a "do.call(mixedorder, mydataframe)" call like the order function does 2- gtools has not been updated in 2.5
2007 Aug 11
0
DOE and interaction plot general question
...he mean of the group. > > > > I want to order this data.frame by the combined rank of Res1 & Res2, but > > where weigths are assigned to the importeance av each column. Lets > assume > > that Res1 is twice as important and lower values rank better. > > > > MyRanks<-data.frame > (Rank1=rank(MyFrame[,"Res1"]),Rank2=rank(MyFrame[,"Res2"]),CombR=2*rank(MyFrame[,"Res1"])+rank(MyFrame[,"Res2"]), > row.names=c("G1","G2","G3","G4","G5")) > > > > Rank1 R...