s-news
[Top] [All Lists]

Re: Data Manipulation

To: s-news@lists.biostat.wustl.edu
Subject: Re: Data Manipulation
From: "Overstreet, Jason (FL51)" <Jason.Overstreet@honeywell.com>
Date: Tue, 10 Jan 2006 09:01:19 -0700

Slight correction...I forgot that V4 is what I want to use as the group variable.  

JLO

_____________________________________________
From: Overstreet, Jason (FL51)
Sent: Tuesday, January 10, 2006 10:36 AM
To: s-news@lists.biostat.wustl.edu
Subject: Data Manipulation

One day, I will be answering questions on this list instead of asking.  In the mean time, I have another data manipulation question.

Below is an example of data having a variable of interest (V1) with duplicate entries for V2 and V3.  I would like to have the mean value of the V1 values assigned to a single line for the V2 and V3. 



Current state of data:

V1      V2       V3     V4

30      a       1       u1

32      NA      1       u1

31      NA      1       u1

28      a       1       u1

2       b       2       u2

3       b       NA      u2

1       b       2       u2

4       b       2       u2

2       b       2       u2

10      c       3       u3

12      c       3       u3

11      c       NA      u3

13      c       3       u3

12      c       3       u3

45      d       4       u4

44      d       4       u4

52      e       NA      u4

Desired result:

V1      V2      V3      V4

30.25   a       1       u1

2.40    b       2       u2

11.60   c       3       u3

44.50   d       4       u4

52      e       NA      u5


Basically I have repeated measurements of varying sample size for a variable of interest (V1) which I want to take the mean. I want to assign it to a single row with a combination of the other variables.  Oh, one more important thing - I have well over a hundred variables that are of type date, factor, integer and double.  I just wanted a simple example for the posting.  Many thanks in advance for any help. 

 

Jason Overstreet

Statistician

Honeywell DSES

(727) 539-3964


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