Re: [R] Splitting Datasets

From: Steve Lianoglou <>
Date: Sun, 27 Mar 2011 23:50:02 -0400


Answers inline:

On Sun, Mar 27, 2011 at 8:50 PM, Wainscott, Robert LT <> wrote:
> On R 2.12 for Mac OSX, I have a dataset with both numerical and
> character values.
> I want to split dataset "ZIDL", into individual datasets based on the
> string content of variable "Dept".
> I can create one subset dataset at a time using a script I found on the
> net, but rather than run the same function 17 times, can R look at the
> "Dept" variable and create subset datasheets of the main datasheet (one
> for each department) with a single command?
> In Minitab, this would be the "Split Worksheet" function.

There is a "split" function in R:

R> ?split

> I am horrible at scripting, but trying to learn fast.

As Bert mentioned, you have to learn the basics of the language first, otherwise you'll never get past the "stabbing in the dark" feeling.

You can start here:

Take a couple of hours to go through that -- there's no way to "learn fast" without first starting slow.

Good luck,

Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info:

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 28 Mar 2011 - 03:54:35 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 Mon 28 Mar 2011 - 04:50:24 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive