s-news
[Top] [All Lists]

Re: Data Extraction

To: "Bruce Green" <brucegreen@verizon.net>
Subject: Re: Data Extraction
From: james.holtman@convergys.com
Date: Mon, 22 Nov 2004 20:57:37 -0500
Cc: s-news@lists.biostat.wustl.edu, s-news-owner@lists.biostat.wustl.edu



sapply(split(df$bp, df$id), function(x)mean(x[1:min(3,length(x))]))

__________________________________________________________
James Holtman        "What is the problem you are trying to solve?"
Executive Technical Consultant  --  Office of Technology, Convergys
james.holtman@convergys.com
+1 (513) 723-2929


                                                                                
                                                               
                      "Bruce Green"                                             
                                                               
                      <brucegreen@verizon.net>         To:       
<s-news@lists.biostat.wustl.edu>                                              
                      Sent by:                         cc:                      
                                                               
                      s-news-owner@lists.biosta        Subject:  [S] Data 
Extraction                                                           
                      t.wustl.edu                                               
                                                               
                                                                                
                                                               
                                                                                
                                                               
                      11/22/2004 18:40                                          
                                                               
                                                                                
                                                               
                                                                                
                                                               




Hi,
I have a large dataset of 20000 rows that contains 180 individuals
identified by a unique identification number. There are 5 columns of data
with health status data in each column, and a different number of rows for
each individual i.e. 5 rows for individual 1 and 20 rows for individual no.
2. I wish to extract the data from the first 3 rows for each individual and
then perform a data function for each individual....i.e. what is the
average blood pressure for individual 1 in the first 3 rows of their data?

I cannot seem to do this easily...any suggestions?

Regards
Dr Bruce Green




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