Re: [R] split data set

From: jim holtman <jholtman_at_gmail.com>
Date: Fri 19 Jan 2007 - 23:48:44 GMT

> abc

  id x y
1 A 3 4
2 A 1 3
3 B 2 6
4 B 4 8
5 C 5 4
6 C 6 7
> split(abc, abc$id)

$A
  id x y
1 A 3 4
2 A 1 3

$B
  id x y
3 B 2 6
4 B 4 8

$C
  id x y
5 C 5 4
6 C 6 7

On 1/19/07, Aimin Yan <aiminy@iastate.edu> wrote:
>
> I have a data(ABC) like this:
>
> x y
> A 3 4
> A 1 3
> B 2 6
> B 4 8
> C 5 4
> C 6 7
>
> I want to split this data into
>
> A:
> x y
> A 3 4
> A 1 3
>
> B
> B 2 6
> B 4 8
>
> C
> C 5 4
> C 6 7
>
> anyone knows how to do that?
>
> thanks,
>
> Aimin Yan
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch 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.
Received on Sat Jan 20 10:51:39 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 20 Jan 2007 - 03:30:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.