From: Jim Jiang xuemin@pharm.usyd.edu.au
Subject: [NMusers] software for transpose
Date: Fri, 09 Dec 2005 11:30:52 +1100

Dear All,

I am using NONMEM to do predictive check. NONMEM generated about 1000 subjects
arranged vertically. To find the percentiles, I need to do data transpose.
Does anyone know how to do it efficiently?

Thanks

Jim Jiang

The Faculty of Pharmacy
The University of Sydney 
_______________________________________________________

From: Pravin Jadhav pravinj@gmail.com
Subject: Re: [NMusers] software for transpose
Date: Fri, 9 Dec 2005 12:32:48 -0500

Jim,
 
Most data editing softwares will allow you to transpose the data efficiently.
Here is an example using Splus.
 
 #CREATE data
data <- data.frame(ID = rep(1:2, each = 2), TIME = rep(c(1, 10), 2), DV = round(rnorm(4, 10, 2), 2))
 #PRINT data
data
ID TIME DV
1 1 7.09
1 10 9.77
2 1 9.98
2 10 11.06
#TRANSPOSE data
t(data)
ID 1.00 1.00 2.00 2.00
TIME 1.00 10.00 1.00 10.00
DV 7.09 9.77 9.98 11.06

However, you might not need to do this for calculating percentiles. There is ?quantile function
in Splus to calculate empirical percentiles. 
Hope it helps.
 
Pravin
_______________________________________________________

From: Pravin Jadhav 
Subject: Re: [NMusers] software for transpose
Date: Fri, 9 Dec 2005 12:55:34 -0500

Hi,
 
May be I missed the question. If you are looking for unstacking (and not transpose), try this:
 
>as.data.frame(split(data, data$ID))
 
Thanks,
 
Pravin
_______________________________________________________