[R] How to find data that includes certain values

jim holtman jholtman at gmail.com
Fri Jan 21 21:37:12 CET 2011


There are several pattern matching functions that will solve your problem:

grep regexpr

do RSiteSearch("pattern match")

On Fri, Jan 21, 2011 at 12:26 PM, poppinkid <jtlu at bcm.edu> wrote:
>
> I am trying to return an index for a data set by searching using filenames.
>
> The name may be ANG_AUT.N.0734C70411A-1_1sA_0734C70411A.fasta, but i'd just
> like to search it using the term "0734C70411"  as the file may be
> 0734C70411A or 0734C70411C or 0734C70411D
>
> Any way to do this other than doing something like this.  where 0734C70411A
> is part of matrix list[,8]
>
> samp=paste("ANG_AUT.N.",list[i,8],"-1_1sA_",list[i,8],".fasta",sep="")
> data[which(data[,2]==samp),]
>
> This is similar to the =~/ / function in perl.
>
>
> Thanks
> --
> View this message in context: http://r.789695.n4.nabble.com/How-to-find-data-that-includes-certain-values-tp3230161p3230161.html
> 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
Data Munger Guru

What is the problem that you are trying to solve?



More information about the R-help mailing list