[R] Scalling/Centering the Data by an Index

From: Ashraf Chaudhary <mchaudha_at_jhsph.edu>
Date: Thu 13 Jul 2006 - 16:43:08 EST

Dear All:
I would like to center the data in 'x' by 'group'. The following code scale the data and I have not been able to figure out how to change it so I get the centered data.  

x <- c(1, 2, 3, 4, 5, 6, 7, 8)
group <- c(1,1,1,2,2,2,2,2)

I would appreciate your help.  


M. Ashraf Chaudhary, Ph.D.
Associate Scientist/Biostatistician
Department of International Health
Johns Hopkins Bloomberg School of Public Health 615 N. Wolfe St. Room W5506
Baltimore MD 21205-2179

(410) 502-0741/fax: (410) 502-6733
 <mailto:mchaudha@jhsph.edu> mchaudha@jhsph.edu Web:

        [[alternative HTML version deleted]]

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 Received on Thu Jul 13 16:47:07 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 13 Jul 2006 - 18:14:17 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.