[R] ordering columns (longitudinal data in wide format)

From: <z.dalton_at_lancaster.ac.uk>
Date: Thu 03 Aug 2006 - 01:09:10 EST


I am working on some longitudinal data in wide format and I am having a problem ordering the data columns. To expand, a subset of what I am working on is as follows;


   L.qol.0 L.qol.0.08 L.qol.0.17 L.qol.0.25 L.qol.0.5 L.qol.0.42 L.qol.0.34 1 83 86 89 92 91 87 90


[1] "L.qol.0" "L.qol.0.08" "L.qol.0.17" "L.qol.0.25" "L.qol.0.5" [6] "L.qol.0.42" "L.qol.0.34"

# in this object s (not a vector), 'L.qol' is measured at time points 0, 0.08, 0.17, 0.25, 0.34, 0.42 and 0.5. As you can see, however, the time points are not in the correct order in object s. Does anyone know how to order these column names along with their corresponding measurements? Clearly s[order(s)] does not work since this just orders the corresponding measurements.

I would be extremely grateful for any help on this matter, it may be really simple, but I have tried for ages.

Thank you,


R-help@stat.math.ethz.ch 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. Received on Thu Aug 03 02:23:40 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 03 Aug 2006 - 12:18:07 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.