On 2011-06-28 09:54, Ana Kolar wrote:
Hi Sarah,

Thank you for your response. Here is a toy example:


library(MatchIt)
data(lalonde)

A<-lalonde
f<-treat ~ age + I(age^2) + educ + I(educ^2) + black + hispan +
     married + nodegree + re74 + I(re74^2) + re75 + I(re75^2)
m<-"nearest"
m.out.base<- matchit(formula=f, data=A, method=m)

B<- match.data(m.out.base)

An<- nrow(A)
Bn<- nrow(B)

Cn<- An - Bn
C<- ??

Can't you just use

 idx <- setdiff(rownames(A), rownames(B))
 C <- A[idx, ]

Peter Ehlers





________________________________
From: Sarah Goslee<sarah.gos...@gmail.com>
To: Ana Kolar<annako...@yahoo.com>
Cc: R<r-help@r-project.org>
Sent: Tuesday, 28 June 2011, 18:44
Subject: Re: [R] extracting data

Hi Ana,

On Tue, Jun 28, 2011 at 12:28 PM, Ana Kolar<annako...@yahoo.com>  wrote:
Let's say I have an original data set which is called A and data extracted from 
this original data set, called B. Based on these A and B data set I would like 
to get data set C which includes all the remaining data from the data set A 
after we exclude data of the data set B.

Any idea how to do this?

Yes. Several.

But to know which one to suggest, I need to know more about your data.

How about a toy example, so the list members can see your index
variables, etc? Or how you created the subset B, and why you can't
just use the opposite of that procedure?

Sarah
--
Sarah Goslee
http://www.functionaldiversity.org



        [[alternative HTML version deleted]]


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to