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)
unsplit(lapply(split(x,group),scale),group)

I would appreciate your help.
 
Ashraf
-----------------______________________________________
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:[EMAIL PROTECTED]> [EMAIL PROTECTED]
Web:http://faculty.jhsph.edu/?F=Mohammad&L=Chaudhary
 

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to