[R] sorting of files using system

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Sat Apr 9 06:18:16 CEST 2016


Wrong list. This is not the Ubuntu shell support mailing list.  The fact that you are using R to get at the operating system command line doesn't make this an R question. 
-- 
Sent from my phone. Please excuse my brevity.

On April 8, 2016 2:18:40 PM PDT, Maria Ninova <begemotche at gmail.com> wrote:
>Hello, I came across the following oddity when it comes to file order 
>using the system command: different system commands return files in a 
>different order:
>This is a real filenames example:
>
> > system("ls gw1kb_tables/rpkm_47*", intern=T)
>[1] "gw1kb_tables/rpkm_479_Input.tab"
>[2] "gw1kb_tables/rpkm_479_IP.tab"
>
> > system("for file in gw1kb_tables/rpkm_4*; do echo $file;done" )
>gw1kb_tables/rpkm_479_IP.tab
>gw1kb_tables/rpkm_479_Input.tab
>
>As you see, in the first case, the "Input" comes first, while in the 
>second, the IP comes first; I was surprised by this result and not sure
>
>if it's expected?
>I am using R version 3.2.2 (2015-08-14) on Ubuntu 15.04
>
>Thank you in advance,
>
>Maria
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]



More information about the R-help mailing list