[R] selecting a subset of files to be processed

Rui Barradas ruipbarradas at sapo.pt
Sat Jul 28 20:00:38 CEST 2012


Hello,

If the files are to be processed in R select a random sample in R.
Using list.files() you can assign a character vector with the filenames 
of interest and then sample from that vector.

?list.files
filenames <- list.files(path, pattern)

rand.sampl <- sample(filenames, 45)

Hope this helps,

Rui Barradas

Em 28-07-2012 18:49, Erin Hodgess escreveu:
> Dear R People:
>
> I am using a Linux system in which I have about 3000 files.
>
> I would like to randomly select about 45 of those files to be processed in R.
>
> Could I make the selection in R or should I do it in Linux, please?
>
> This is with R-2.15.1.
>
> Thanks,
> erin
>
>



More information about the R-help mailing list