Re: [R] translate grouped data to their centroid

2013-01-02 Thread Michael Friendly
On 1/1/2013 3:43 PM, Prof Brian Ripley wrote: On 01/01/2013 19:50, Michael Friendly wrote: Given a data set with a group factor, I want to translate the numeric variables to their centroid, by subtracting out the group means (adding back the grand means). ... Yes. It is part of the calculat

Re: [R] translate grouped data to their centroid

2013-01-01 Thread Prof Brian Ripley
On 01/01/2013 20:43, Prof Brian Ripley wrote: On 01/01/2013 19:50, Michael Friendly wrote: Given a data set with a group factor, I want to translate the numeric variables to their centroid, by subtracting out the group means (adding back the grand means). The following gives what I want, but th

Re: [R] translate grouped data to their centroid

2013-01-01 Thread Prof Brian Ripley
On 01/01/2013 19:50, Michael Friendly wrote: Given a data set with a group factor, I want to translate the numeric variables to their centroid, by subtracting out the group means (adding back the grand means). The following gives what I want, but there must be an easier way using sweep or apply

[R] translate grouped data to their centroid

2013-01-01 Thread Michael Friendly
Given a data set with a group factor, I want to translate the numeric variables to their centroid, by subtracting out the group means (adding back the grand means). The following gives what I want, but there must be an easier way using sweep or apply or some such. iris2 <- iris[,c(1,2,5)] mea