[R] File selection by condition

jim holtman jholtman at gmail.com
Fri Sep 28 21:27:35 CEST 2007


Read the files in, select those that meet the criteria and store them in a list

match.list <- list()
for (i in list.files(pattern="some pattern")){
    x.in <- read.table(i)
    if (your match criteria) match.list[[i]] <- x.in
}

On 9/28/07, Svempa <fempa at yahoo.com> wrote:
>
> I have a large number of textfiles, and one matix in every texfile. I now
> want to find an easy way to select those textfiles that contain at least one
> value over a certain limit, and collect those matrices in a vector or
> something alike. How do I do that?
>
> --
> View this message in context: http://www.nabble.com/File-selection-by-condition-tf4534428.html#a12940278
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list