Re: [R] Searching for specific values in a matrix

2009-07-28 Thread Martin Maechler
[mailto:r-help-boun...@r-project.org] On Behalf Of BertG Steve Lianoglou Sent: Monday, July 27, 2009 3:17 PM BertG To: Mehdi Khan Cc: r-help@r-project.org Subject: Re: BertG [R] Searching for specific values in a matrix BertG Ahh .. BertG On Jul 27, 2009, at 6:01 PM, Mehdi Khan

Re: [R] Searching for specific values in a matrix

2009-07-28 Thread Steve Lianoglou
quick question, i am trying to get an interval of values now with this code by toggling the tolerance limit. is there any way i can modify this code to find values which are within limits of BOTH latitude and longitude? currently i have to pick one or the other. It's not really clear

Re: [R] Searching for specific values in a matrix

2009-07-28 Thread Mehdi Khan
Yes this is working quite well. Basically, I am comparing data obtained from GIS to data obtained from R. It's turning out that the latitude and longitude values from GIS are not matching exactly those obtained in R, and therefore I am trying to find the variance in the data. On Tue, Jul 28,

Re: [R] Searching for specific values in a matrix

2009-07-28 Thread Mehdi Khan
: Re: BertG [R] Searching for specific values in a matrix BertG Ahh .. BertG On Jul 27, 2009, at 6:01 PM, Mehdi Khan wrote: Even when choosing a value from the first few rows, it doesn't work. okay here it goes: rearranged[1:10, 1:5] x y band1 VSCAT.001 soiltype

Re: [R] Searching for specific values in a matrix

2009-07-28 Thread Mehdi Khan
To: Mehdi Khan Cc: r-help@r-project.org Subject: Re: BertG [R] Searching for specific values in a matrix BertG Ahh .. BertG On Jul 27, 2009, at 6:01 PM, Mehdi Khan wrote: Even when choosing a value from the first few rows, it doesn't work. okay here it goes: rearranged

Re: [R] Searching for specific values in a matrix

2009-07-27 Thread Mehdi Khan
i am able to return the first column, but anything else returns this: 0 rows (or 0-length row.names) any idea? On Tue, Jul 21, 2009 at 12:49 PM, Steve Lianoglou mailinglist.honey...@gmail.com wrote: On Jul 21, 2009, at 3:27 PM, Mehdi Khan wrote: I understand your explanation about the

Re: [R] Searching for specific values in a matrix

2009-07-27 Thread Steve Lianoglou
On Jul 27, 2009, at 2:54 PM, Mehdi Khan wrote: i am able to return the first column, but anything else returns this: 0 rows (or 0-length row.names) any idea? I'm not sure what you're doing. The result you're getting happens when no rows pass the logical test that you are using to index

Re: [R] Searching for specific values in a matrix

2009-07-27 Thread Steve Lianoglou
On Jul 27, 2009, at 3:50 PM, Mehdi Khan wrote: the problem is, it works with the example data i gave. however, it does NOT work with the data set i have, which is 600,000 rows. the class is still a data frame. So the problem must be in your data, or what you think is in your data.

Re: [R] Searching for specific values in a matrix

2009-07-27 Thread Steve Lianoglou
no luck, it's okay, i will figure it out! i might isolate and recombine all the columns, maybe that will work. thanks for the help! No, wait .. no luck in being able to select out rows from your data.frame using values you see somewhere in the top 10 rows? Can you just paste in some key

Re: [R] Searching for specific values in a matrix

2009-07-27 Thread Steve Lianoglou
Ahh .. On Jul 27, 2009, at 6:01 PM, Mehdi Khan wrote: Even when choosing a value from the first few rows, it doesn't work. okay here it goes: rearranged[1:10, 1:5] xy band1 VSCAT.001 soiltype 1 -124.3949 40.42468NANA CD 2 -124.3463 40.27358NA

Re: [R] Searching for specific values in a matrix

2009-07-27 Thread Bert Gunter
, 2009 3:17 PM To: Mehdi Khan Cc: r-help@r-project.org Subject: Re: [R] Searching for specific values in a matrix Ahh .. On Jul 27, 2009, at 6:01 PM, Mehdi Khan wrote: Even when choosing a value from the first few rows, it doesn't work. okay here it goes: rearranged[1:10, 1:5] x

Re: [R] Searching for specific values in a matrix

2009-07-27 Thread Mehdi Khan
the problem is, it works with the example data i gave. however, it does NOT work with the data set i have, which is 600,000 rows. the class is still a data frame. On Mon, Jul 27, 2009 at 12:15 PM, Steve Lianoglou mailinglist.honey...@gmail.com wrote: On Jul 27, 2009, at 2:54 PM, Mehdi Khan

Re: [R] Searching for specific values in a matrix

2009-07-27 Thread Mehdi Khan
no luck, it's okay, i will figure it out! i might isolate and recombine all the columns, maybe that will work. thanks for the help! On Mon, Jul 27, 2009 at 1:00 PM, Steve Lianoglou mailinglist.honey...@gmail.com wrote: On Jul 27, 2009, at 3:50 PM, Mehdi Khan wrote: the problem is, it

Re: [R] Searching for specific values in a matrix

2009-07-27 Thread Mehdi Khan
it worked! thank you so much!! On Mon, Jul 27, 2009 at 3:16 PM, Steve Lianoglou mailinglist.honey...@gmail.com wrote: Ahh .. On Jul 27, 2009, at 6:01 PM, Mehdi Khan wrote: Even when choosing a value from the first few rows, it doesn't work. okay here it goes: rearranged[1:10, 1:5]

Re: [R] Searching for specific values in a matrix

2009-07-27 Thread Mehdi Khan
Even when choosing a value from the first few rows, it doesn't work. okay here it goes: rearranged[1:10, 1:5] xy band1 VSCAT.001 soiltype 1 -124.3949 40.42468NANA CD 2 -124.3463 40.27358NANA CD 3 -124.3357 40.25226NANA

[R] Searching for specific values in a matrix

2009-07-21 Thread Mehdi Khan
Hello all, I have a seemingly simple question which I have searched for an answer for for a few hours without luck. I have a matrix of both values and characters with thousands of rows. I would like to run a search of this matrix for certain values and would like the search to retrieve the

Re: [R] Searching for specific values in a matrix

2009-07-21 Thread Steve Lianoglou
Hi, On Jul 21, 2009, at 1:47 PM, Mehdi Khan wrote: Hello all, I have a seemingly simple question which I have searched for an answer for for a few hours without luck. I have a matrix of both values and characters with thousands of rows. I would like to run a search of this matrix for

Re: [R] Searching for specific values in a matrix

2009-07-21 Thread Steve Lianoglou
On Jul 21, 2009, at 1:47 PM, Mehdi Khan wrote: Hello all, I have a seemingly simple question which I have searched for an answer for for a few hours without luck. I have a matrix of both values and characters with thousands of rows. I would like to run a search of this matrix for

Re: [R] Searching for specific values in a matrix

2009-07-21 Thread Steve Lianoglou
I am a bit confused as to what the following command does: evens - df$nums %% 2 == 0 It returns a logical vector (I'm calling this an indexing vector) that is TRUE where df$nums %% 2 == 0 (%% is modulo division, and 4 mod 2 == 0 -- so it's a test for being even) In my matrix example,

Re: [R] Searching for specific values in a matrix

2009-07-21 Thread Steve Lianoglou
On Jul 21, 2009, at 3:27 PM, Mehdi Khan wrote: I understand your explanation about the test for even numbers. However I am still a bit confused as to how to go about finding a particular value. Here is an example data set col # attr1attr2 attr 3LONLAT 17209

Re: [R] Searching for specific values in a matrix

2009-07-21 Thread Mehdi Khan
I am a bit confused as to what the following command does: evens - df$nums %% 2 == 0 In my matrix example, let's say I am looking for the variable(s) BC and I want R to return all the rows with that value... or If I want a value such as 33.543. How would I get it to do that? Just a single

Re: [R] Searching for specific values in a matrix

2009-07-21 Thread Mehdi Khan
I understand your explanation about the test for even numbers. However I am still a bit confused as to how to go about finding a particular value. Here is an example data set col # attr1attr2 attr 3LONLAT 17209 DNANA -122.9409 38.27645 17210

Re: [R] Searching for specific values in a matrix

2009-07-21 Thread Mehdi Khan
thank you VERY much, I have to run now, but I will look at this in the next few days (going on a field trip). I really appreciate it! Mehdi Khan On Tue, Jul 21, 2009 at 12:49 PM, Steve Lianoglou mailinglist.honey...@gmail.com wrote: On Jul 21, 2009, at 3:27 PM, Mehdi Khan wrote: I