search for: mixedsort

Displaying 20 results from an estimated 23 matches for "mixedsort".

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 vector** as the argument to be sorted or ordered and, as the above indicates, they perform exactly as advertised....
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 years Are you aware of an equivalent of this function in base R or a another contributed package...
2018 Mar 12
1
Equivalent of gtools::mixedsort in R base
...] ?order ?ordered ?rank On Sun, 11 Mar 2018, Bert Gunter wrote: > ??? > >> 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 vector** as the argument to be sorted or ordered and, as > the above indicates, they perform...
2018 Mar 12
0
Equivalent of gtools::mixedsort in R base
...Mar 12, 2018 at 12:15 AM, Sebastien Bihorel <sebastien.bihorel at cognigencorp.com> wrote: > 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 years > > Are you aware of an equivalent of this function in base R or a...
2018 Mar 12
0
Equivalent of gtools::mixedsort in R base
...8 at 9:15 PM, Sebastien Bihorel < sebastien.bihorel at cognigencorp.com> wrote: > 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 years > > Are you aware of an equivalent of this function in base R...
2017 Jun 29
1
about reading files in order
Thanks for that answer. I was not aware of gtools::mixedsort <https://www.rdocumentation.org/packages/gtools/versions/3.5.0/topics/mixedsort> function. Jean On Thu, Jun 29, 2017 at 2:47 PM, Henrik Bengtsson < henrik.bengtsson at gmail.com> wrote: > You can use: > > > files <- list.files(path = "folder01") > > fil...
2006 Jan 11
3
natural sorting
It would be nifty to incorporate this into R or into an R package: http://sourcefrog.net/projects/natsort/
2017 Jun 29
0
about reading files in order
You can use: > files <- list.files(path = "folder01") > files <- gtools::mixedsort(files) to order the files in a "human-friendly" order rather than lexicographic order (which sort() provides). FYI 1; it's preferred to use file.path("folder01", list[i]) rather than paste('folder01',lists[i],sep='/'). FYI 2; if you use list.files(path = &...
2017 Jun 29
2
about reading files in order
Hi R users, I have a question about opening the txt files and putting them into a matrix. The txt files are in the folder01, while they have the name file.1.txt, file.2.txt, file.3.txt, etc. There are about 200 such text files. Each txt file contains one value inside. When I tried to use the code below, I found that the txt files are not in order, from 1, 2, 3, to 200. Rather, they are in the
2004 Aug 27
3
reorder [stats] and reorder.factor [lattice]
It was recently pointed out on the lists that the S-PLUS Trellis suite has a function called reorder.factor that's useful in getting useful ordering of factors for graphs. I happily went ahead and implemented it, but it turns out that R (not S-PLUS) has a generic called reorder (with a method for "dendrogram"). Naturally, this causes R to think I'm defining a method for
2013 Jan 24
0
How to add a function to another written code?
...e.I get both RMSE map,corr map. RMSE function RMSE <- function(obs, sat){ sqrt(mean((obs-sat)^2, na.rm=T)) } Corr code dir1 <- list.files("D:\\2010\\data\\monthly", "*.bin", full.names = TRUE) dir1<- mixedsort(dir1) dir2 <- list.files("D:\\RE01\\MIR_CLF3MD\\2010\\final-2010", "*.envi", full.names = TRUE) dir2<- mixedsort(dir2) file_tot<-array(dim=c(1440,720,12,2)) for(i in 1:length(dir1)){ file_tot[,,i,1] <- readBin(dir1[i], numer...
2012 Feb 28
2
Error: could not find function "hier.part"
...gtools::defmacro gtools::even gtools::foldchange gtools::foldchange2logratio gtools::inv.logit gtools::invalid gtools::keywords gtools::logit gtools::logratio2foldchange gtools::mixedorder gtools::mixedsort gtools::odd gtools::permutations gtools::permute gtools::quantcut gtools::rdirichlet gtools::running gtools::scat gtools::setTCPNoDelay gtools::smartbind gtools::sprint gtools...
2012 May 28
1
Why R order files as 1 10 100 not 1 2 3 ?
The code given below worked well. However, the problem is that when I typed dir1 to see the results I found that R order the files as: [1] "data1.flt" "data10.flt" "data100.flt" "data101.flt" [5] "data102.flt" "data103.flt" "data104.flt" "data105.flt" [9] "data106.flt" "data107.flt"
2004 Sep 17
1
R-2.0.0 Install problem for package bundle with inter-dependent n amespaces
...nverted into a package bundle each of which has a namespace: gplots, gmodels, gdata, gtoools. Of course, there are interdependencies among these namespaces: gsun374: /tmp [11]> cd gregmisc/ gsun374: gregmisc [12]> grep import */NAMESPACE gdata/NAMESPACE:importFrom(gtools, odd, invalid, mixedsort) gmodels/NAMESPACE:importFrom(MASS, ginv) gplots/NAMESPACE:importFrom(gtools, invalid) gplots/NAMESPACE:importFrom(gtools, odd) gplots/NAMESPACE:importFrom(gdata, nobs) Under R-1.9.1, this package bundle passes R CMD check and installs happily. However, under yesterday's R-2.0.0-alpha, the...
2006 Aug 02
1
ordering columns (longitudinal data in wide format)
Hi, I am working on some longitudinal data in wide format and I am having a problem ordering the data columns. To expand, a subset of what I am working on is as follows; >s L.qol.0 L.qol.0.08 L.qol.0.17 L.qol.0.25 L.qol.0.5 L.qol.0.42 L.qol.0.34 1 83 86 89 92 91 87 90 >names(s) [1] "L.qol.0" "L.qol.0.08"
2007 May 18
3
ordering in list.files
Hi R, My csv files are stored in the order, '1abc.csv', '2def.csv', '3ghi.csv', '10files.csv' in a folder. When I read this into R from list.files (R command: x=list.files("Z:/CSV/fold",full.names=F), I don't get the same order, instead I get the order as "10files.csv" "1abc.csv" "2def.csv" "3ghi.csv". But
2010 Jul 17
4
sort file names in numerical order
Hello, I get some file names by list.files(). These names are in alphabetical order. I want to change it to logical numeric order. Example: > fileNames <- c("A10", "A1", "A2", "B1", "B2", "B10") > sort(fileNames) [1] "A1" "A10" "A2" "B1" "B10" "B2" I want to have:
2008 Dec 22
1
sorting variable names containing digits
Dear r-helpers, I'm looking for a way of sorting variable names in a "natural" order, when the names are composed of digits and other characters. I know that this is a vague idea, and that sorting character strings is a complex topic, but perhaps a couple of examples will clarify what I mean: > s <- c("x1b", "x1a", "x02b", "x02a",
2011 Feb 03
2
Sorting a Data Frame by hybrid string / number key
Hi, I'm trying to present a table of some experimental data, and I want to order the rows by the instance names. The issue I've got is that there are a variety of conventions for the instance names (e.g. competition01, competition13, small_1, big_20, med_9). What I want to be able to sort them first in category order so: competition < small < med < big, and then perform the
2007 Dec 03
3
Ordering the levels of a vector
Hi, I have a vector in a data frame that looks something like this: day<-c('Day -1','Day 6','Day 10') This vector specifies the order in which several panel will appear in a lattice plots. But the order in which such plots will appear will be the following: Day -1, Day 10, Day 6. Which makes sense, but I cannot name the Days like this: Day -01,Day 10, Day 06,