On Mon, 29 Sep 2003 [EMAIL PROTECTED] wrote:
>
> Hi All,
>
> I want to ask if there is a transpose function for data frame like the
> procedure of transpose in SAS? Because I want to partially transpose a
> data frame which contains 5 columns (siteid, date, time, obs, mod), what
> I want to do is to put time as the column variables along with siteid,
> and date, and put obs and mod in the row names. specifically to
I think reshape() does what you want
-thomas
> transpose a data frame:
>
> siteid date time obs mod
> A 7/8 01 2 5
> A 7/8 02 3 8
> A 7/8 03 5 8
> A 7/9 01 3 6
> A 7/9 02 5 8
> A 7/9 03 6 7
> ......
> B 7/8 01 4 7
> B 7/8 02 7 19
> B 7/8 03 4 9
> ......
>
> To
>
> siteid date name 01 02 03 ....
> A 7/8 obs 2 3 5
> A 7/8 mod 5 8 8
> A 7/9 obs 3 5 6
> A 7/9 mod 6 8 7
> .......
> B 7/8 obs 4 7 4
> B 7/8 mod 7 19 9
> ........
>
>
> Thank you very much!
>
> Dave
>
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
Thomas Lumley Assoc. Professor, Biostatistics
[EMAIL PROTECTED] University of Washington, Seattle
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help