Skip to content
Back to formatted view

Raw Message

Message-ID: <loom.20081221T153614-458@post.gmane.org>
Date: 2008-12-21T15:43:40Z
From: oliver
Subject: Dataframe help

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