[R] Transpose a dataset

Rolf Turner r.turner at auckland.ac.nz
Tue Aug 18 22:29:50 CEST 2009


You mean ***transform*** a dataset, not ``transpose''.  Transposition
is something done to a matrix.  If you do not get your terminology
straight, no one can help you.

You may get some mileage out of the reshape() function; possibly you
may need the more elaborate facilities in the reshape package.

	cheers,

		Rolf Turner

On 18/08/2009, at 4:00 PM, rajclinasia wrote:

>
> Hi Everyone,
>
> I have a dataset like this
>
>                                       mean         sd    0%        
> 25%   50%
> 75%  100%   n
> BODY TEMPERATURE          36.41099  0.4015699  35.1  36.22222  36.5
> 36.66667  37.1  89
> DIASTOLIC BLOOD PRESSURE  73.60079  9.4656186  50.0  67.00000  73.0
> 80.00000  95.0 253
> HEIGHT                   171.94000  9.2011670 153.5 166.50000 173.0
> 176.25000 190.0  20
> PULSE RATE                67.48221 11.7657645  40.0  60.00000  68.0
> 75.00000  97.0 253
> SYSTOLIC BLOOD PRESSURE  131.91700 14.4986667  97.0 122.00000 132.0
> 140.00000 185.0 253
> WEIGHT                    85.17079 17.3150434  57.3  70.90000  83.1
> 100.00000 122.5  89
>
> now i want to transpose this dataset like
>
> BODY TEMPERATURE  mean 36.41099
>                               sd     0.4015699
>                               0%    35.1
>                               25%  36.222
>                               50%  36.5
>                               75%  36.667
>                               100% 37.1
>                               n        89
>
> DIASTOLIC BLOOD PRESSURE  mean
>                                           sd
>                                           0%
>                                           25%
>                                          50%
>                                          75%
>                                          100%
>                                           n
>                                                        etc.
> if possible please send me the code. it will be very helpful us.
>
> Thanks in Advance.
>
> -- 
> View this message in context: http://www.nabble.com/Transpose-a- 
> dataset-tp25018071p25018071.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting- 
> guide.html
> and provide commented, minimal, self-contained, reproducible code.


######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}




More information about the R-help mailing list