Try which()
> myDF <- data.frame(x1=runif(4),x2=1:4)
> myNum <- 2
> which(myDF[,2]==myNum)
[1] 2
> myDF[,2]==myNum
[1] F T F F
Is this what you had in mind? I can't say if it will be any faster, but
maybe...
Sundar
"Lambert.Winnie" wrote:
>
> S-PLUS 6 R2 MSWindows 2000
>
> All,
>
> I have a dataframe with 11,000,000 rows and 2 columns (call it myDF). I need
> to match a number (myNum) with a value in the second column in order to find
> the value I want in the first column so that myNum == myDF[?,2]. Given that
> the dataframe is so huge, I want to refrain from creating a logical vector
> and subscripting to find the correct row in the data frame. It takes too
> long and too much memory, and I need to do these matches with lots of
> numbers. Is there a function that will take as input myNum and match it with
> a value in myDF[,2] and at least give me the row number? I looked at match
> and it did not do what I wanted, unless I did not enter things correctly. I
> prefer not to make myDF smaller.
>
> ***********************************************************************
> Winifred C. Lambert Senior Scientist/Meteorologist
> ENSCO, Inc.
> Aerospace Sciences and Engineering Division
> 1980 N. Atlantic Ave, Suite 230
> Cocoa Beach, FL 32931
> VOICE: 321.853.8130 FAX: 321.853.8415
> lambert.winifred@ensco.com
>
> AMU Quarterly Reports are available online:
> http://science.ksc.nasa.gov/amu/home.html
> ***********************************************************************
> --------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu. To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message: unsubscribe s-news
--
Sundar Dorai-Raj, Ph.D.
Statistical Methods Engineer
PDF Solutions, Inc.
Richardson TX
(972) 889-3085 x216
(214) 392-7619 cell
sundar.dorai-raj@pdf.com
|