Skip to content
Back to formatted view

Raw Message

Message-ID: <1837865343.1116441566@Lab26.DOMAIN.IE.PITT.EDU>
Date: 2005-05-18T22:39:26Z
From: sms13+@pitt.edu
Subject: from list to dataframe

I was wondering if someone can help me figure out the following:
I have two patient datasets, ds1 and ds2.  ds1 has fields "patid", "date", 
and "lab1".  ds2 has "patid", "date", and "lab2".  I want to find all the 
patids that have at least 2 dated records for each lab.  I started by 
splitting each dataset by patid, to create ds1.list and ds2.list.  Then I 
did some processing (with sapply) to each list to get the lengths of each 
patient list item.  Then I kind of lost my way and things got messy as I 
tried to extract just the patids of those with lengths >= 2, convert them 
to dataframes (which I didn't have much success with), and then merge the 
two dataframes to get a vector of the desired patids.  Any help would be 
much appreciated.

Thanks,
Steven