Re: [R] subset with multiple criteria

2008-06-23 Thread Gabor Grothendieck
Just add a column to E.corr that is 1, 2, ... E.coor$id <- 1:nrow(E.coor) and now repeat the merge and SQL solutions. On Mon, Jun 23, 2008 at 1:49 PM, <[EMAIL PROTECTED]> wrote: > Thanks for your answers. > I'm sorry. I'm afraid I didn't pose correctly the question , and the use > os "subset"

Re: [R] subset with multiple criteria

2008-06-23 Thread jgarcia
Thanks for your answers. I'm sorry. I'm afraid I didn't pose correctly the question , and the use os "subset" was misleading. What I need is to obtain the index of the corresponding rows in E.coor, to subtitute the corresponding values by new updated values. The closest answer to what I really nee

Re: [R] subset with multiple criteria

2008-06-23 Thread Gabor Grothendieck
Here are two solutions: # 1 merge(subset.coor, E.coor) # 2 # note that we changed the names of the data frames # for this solution since dot is an operator in SQL library(sqldf) sqldf("select * from subset_coor natural join E_coor") On Mon, Jun 23, 2008 at 12:32 PM, <[EMAIL PROTECTED]> wrote:

Re: [R] subset with multiple criteria

2008-06-23 Thread jim holtman
?merge > E <- read.table(textConnection("east north dat + 1 582650 4248850 0.8316848 + 2 582750 4248850 0.7230272 + 3 582850 4248850 0.3250818 + 4 582950 4248850 0.6144006 + 5 583050 4248850 0.8706312 + 6 583150 4248850 0.2149651 + 7 583250 4248850 0.1659519 + 8 583350 4248850

Re: [R] subset with multiple criteria

2008-06-23 Thread jim holtman
You can also do this: > E[(E$east %in% sub$east) & (E$north %in% sub$north),] east north dat 1 582650 4248850 0.8316848 7 583250 4248850 0.1659519 > On Mon, Jun 23, 2008 at 12:32 PM, <[EMAIL PROTECTED]> wrote: > This should be theoretically very simple, but I dont get the elegant >

[R] subset with multiple criteria

2008-06-23 Thread jgarcia
This should be theoretically very simple, but I dont get the elegant answer (without looping). I've got a long (thousands of rows) data frame: > E.coor[1:10,] east north dat 1 582650 4248850 0.8316848 2 582750 4248850 0.7230272 3 582850 4248850 0.3250818 4 582950 4248850 0.614400