Re: [R] subset rows in two dataframes

2008-05-11 Thread partofy
Not exactly. I need something to subset ONLY rows common to both dataframes. In the provided example, dat1 and dat2 have no common rows so I would expect: [1] v1 v2 0 rows (or 0-length row.names) But I canĀ“t do it... On Sun, 11 May 2008 10:07:25 -0400, Zhuanshi He [EMAIL PROTECTED] said:

[R] subset rows in two dataframes

2008-05-10 Thread partofy
Dear list: I have two dataframes, say dat1 and dat2. Each has several variables but 3 of each are common in both, (say v1, v2 and v3). v1 and v2 are factores while v3 is numeric. Now, I need a subset to extract the rows in which v1, v2 and v3 are the same in both dataframes. I tried:

Re: [R] subset rows in two dataframes

2008-05-10 Thread partofy
Thanks for your reply. In fact I dont get none error message, I just simply found that some rows do not match in both dataframes. I thought it was some evident problem with my code, but it seems it is not. I'll try to check and if I can, I'll post a reproducible example. Justin On Sat, 10 May

[R] split and subset

2008-05-06 Thread partofy
Dear list: I ask for your help in a simple problem in which I'm not figuring out the solution My data looks like: dat- data.frame(date=c(12/12/1980, 03/11/1994, 15/11/1999, 31/10/2000, 20/03/2007, 05/01/2001), var1=c(A, A, B, D, C, A), var2=runif(6)) I was wondering if I could split the column

[R] help with subset

2008-05-02 Thread partofy
Dear list: I have a problem using the subset function: dat- data.frame(treatment=c(A, B, A, C, C, D, A, D, C, D), response=rnorm(10)) I am interested in treatments A, B and D vec- c(A, B, D) But I can only obtain what I want with: subset(dat, treatment==A | treatment==B | treatment==D) What's

Re: [R] help with subset

2008-05-02 Thread partofy
Thank you Christos and Jim: That is precisely what I was after. On Sat, 3 May 2008 00:01:58 -0400, Christos Hatzis [EMAIL PROTECTED] said: Try %in% subset(dat, treatment %in% vec) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL