Skip to content
Back to formatted view

Raw Message

Message-ID: <73f827b50809082017v1390152l20f83186e41c73e0@mail.gmail.com>
Date: 2008-09-09T03:17:30Z
From: Gundala Viswanath
Subject: Splitting Data Frame into Two Based on Source Array

Dear all,

Suppose I have this data frame:


> data_main
   V1  V2
foo    13.1
bar   12.0
qux   10.4
cho  20.33
pox   8.21

And I want to split the data into two parts
first part are the one contain in the source array:

> src
[1] "bar" "pox"

and the other one the complement.

In the end we hope to get this two dataframes:

> data_child1
     V1 V2
bar   13.1
pox   8.21

and

> data_child2_complement
foo 13.1
qux 10.4
cho 20.33

Is there a compact way to do it in R?




- Gundala Viswanath
Jakarta - Indonesia