Re: [R] Ordering Filenames stored in list or vector

2015-12-07 Thread BARLAS Marios 247554
tarting my PhD I feel like I want something more "integrated" Thanks, Mario From: Mark Sharp [msh...@txbiomed.org] Sent: Friday, December 04, 2015 5:25 PM To: BARLAS Marios 247554 Cc: r-help@r-project.org Subject: Re: [R] Ordering Filenames stor

[R] Ordering Filenames stored in list or vector

2015-12-04 Thread BARLAS Marios 247554
Hello everyone, I am an R rookie and I'm learning as I program. I am working on a script to process a large amount of data: I read a pattern of filenames in the folder I want and import their data filenames = list.files(path, pattern="*Q_Read_prist*") myfiles = lapply(filenames, function(x)

Re: [R] Ordering Filenames stored in list or vector

2015-12-04 Thread Boris Steipe
The thread below has a number of solutions. I personally like the one with sprintf(). https://stat.ethz.ch/pipermail/r-help/2010-July/246059.html B. On Dec 4, 2015, at 5:51 AM, BARLAS Marios 247554 wrote: > Hello everyone, > > I am an R rookie and I'm learning as I

Re: [R] Ordering Filenames stored in list or vector

2015-12-04 Thread Mark Sharp
Mario, I am certain there are more elegant solutions. This is an effort to make the process clear by dividing out each transformation used into separate lines. ## Start of code library(stringi) # This is written in C and C++ (ICU library), is fast, and is well documented. filenames <-

Re: [R] Ordering Filenames stored in list or vector

2015-12-04 Thread Henrik Bengtsson
> filenames <- c("Q_Read_prist#1...@1.xls", "Q_Read_prist#1...@10.xls", > "Q_Read_prist#1...@2.xls") > filenames <- gtools::mixedsort(filenames, numeric.type="decimal") > filenames [1] "Q_Read_prist#1...@1.xls" "Q_Read_prist#1...@2.xls" "Q_Read_prist#1...@10.xls" /Henrik On Fri, Dec 4, 2015