Rajasekaramya <ramya.victory <at> gmail.com> writes: > > > Hi there, > > I have a dataframe length.unique.info > > length.unique.info > abc 12 345 > def 16 550 > lmn 6 600 > I want those names that fall under the condition (length.unique.info[,2][i] > <=5 && length.unique.info[,3][i] >=500) [...]
Hello, late answer, but I just looked in the archive... ...and found your question. Maybe it's too long ago, but as I has some time for and fun with it, here a way how to achieve it: intersect( which(mydf[,2] <=5 ), which( mydf[,3] >= 500)) This will result in integer(0), which means, no matching data found. intersect( which(mydf[,2] <=8 ), which( mydf[,3] >= 500)) would bring you 3 as an answer. This is the index 3, which means third row does match. So, you dont need a loop, which I assume you would like to use, when using i as an index (maybe in the range 1:nrow(length.unique.info). Ciao, Oliver ______________________________________________ R-help@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.