s-news
[Top] [All Lists]

Split function

To: "S-News" <s-news@lists.biostat.wustl.edu>
Subject: Split function
From: "Walter R. Paczkowski" <dataanalytics@earthlink.net>
Date: Fri, 15 Apr 2005 14:31:00 +0000
Domainkey-signature: a=rsa-sha1; q=dns; c=simple; s=test1; d=earthlink.net; h=Subject:From:To:Disposition-Notification-To:Date:Content-Type:Organization:Content-Transfer-Encoding:MIME-Version; b=JHA/q8eVsob+EfMW+xso1ZzkduNgkD4R2gQxR+cIIVZtTofBqVDhRGsHS92eiuRS;
Organization: Data Analytics Corp.
Good morning,

I'm working with a large set of data from a jewelry market survey.  There are 
over 7000 respondents who answer questions about their gender, future jewelry 
purchase plans, class of jewelry purchase (bridal, a self purchase or a gift), 
and the type of style (bracelet, etc.).  Each person has an ID.  I'd like to 
create a list of lists that has the ID numbers for each combination of 
categories: gender, plans, class, style.  I could then find the IDs I want by 
typing, say, z$Male$Yes$Gift$Bracelet, or write a function to call each of 
these combinations for further data analysis.  I want to avoid missing a 
combination.

SPLIT allows me to easily split the data by gender - no big deal.  Just 
split(x, gender).  Splitting each gender by purchase plans is harder, but 
doable.  The result of a little effort is z$Male$Yes, z$Male$No, z$Female$Yes, 
z$Female$No.  Perfect for my purpose.  But after that, the task becomes more 
difficult because of the need to keep track of the levels of each option - or 
at least the way I was trying to do it.  SPLIT can't seem to take a list of 
groups and then to successively apply them, such as split(x, list(gender, 
plans, class, style)).  Does anyone know of a function that would allow me to 
do what I want?  Or should I forget this and try some other way to easily get 
the IDs for a bunch of conditions?

Thanks,

Walt Paczkowski
________________________

Walter R. Paczkowski, Ph.D.
Data Analytics Corp.
44 Hamilton Lane
Plainsboro, NJ  08536
(V) 609-936-8999
(F) 609-936-3733


<Prev in Thread] Current Thread [Next in Thread>