Wainscott, Robert LT <robert.wainscott <at> cvn74.navy.mil> writes:

> I want to split dataset "ZIDL", into individual datasets based on the
> string content of variable "Dept".

There are many, many ways to do this, depending on what you're really after.
Here's one:

depts = levels(factor(zidl$dept))
for (i in 1:length(depts)) {
  tiny.dataset = subset(zidl, dept==depts[i])
  # now do whatever processing you need with tiny.dataset
}

Read the Introduction to R and the help page for the subset command, 
i.e., ?subset

______________________________________________
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