Re: [R] Split a vector(list) into 3 list

From: Leeds, Mark (IED) <Mark.Leeds_at_morganstanley.com>
Date: Thu, 17 May 2007 20:21:05 -0400

If temp is your vector then split(index(temp),temp) will give you what you want.

-----Original Message-----
From: r-help-bounces_at_stat.math.ethz.ch
[mailto:r-help-bounces_at_stat.math.ethz.ch] On Behalf Of Patrick Wang Sent: Thursday, May 17, 2007 8:15 PM
To: r-help_at_stat.math.ethz.ch
Subject: [R] Split a vector(list) into 3 list

Hi,

I have a vector contains values 1,2,3.

Can I call a function split to split it into 3 vectors with 1 corresponds to value ==1, which contain all the indexes for value==1.

2 corresponds to value ==2 which contain all the indexes for value=2

Thanks
pat



R-help_at_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.

This is not an offer (or solicitation of an offer) to buy/se...{{dropped}}



R-help_at_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 Fri 18 May 2007 - 00:29:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 May 2007 - 01:31:17 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.