Tuesday, March 4, 2008

Repeated Measures

First, we will want to read our data into R. The data, called ThreeTimePoint.sav, are in the SPSS (.sav) format. In order to read data in the .sav format into R, we need to use a function that is available in the

foreign

library. Load the library and read in the data using the following commands.


> library(foreign)
> depression=read.spss("ThreeTimePoint.sav", to.data.frame=T)
> attach(depression)



Next, we will examine the data.



> depression
BEFORE AFTER FOLLOWUP
1 2 3 5
2 4 7 9
3 6 8 8
4 8 9 8
5 10 13 15
6 3 4 9
7 6 9 8
8 9 11 10