what is the easiest way to get from> xx1 x2 [1,] 2 3 [2,] 3 2 [3,] 1 3 [4,] 1 4 the matrix xbar> xbar1x1 x2 [1,] 1.75 3 [2,] 1.75 3 [3,] 1.75 3 [4,] 1.75 3 with the mean of the columns of x as values? thanks christoph -- Christoph Lehmann <lehmann at puk.unibe.ch> University Hospital of Clinical Psychiatry
Hoi Christoph, --On woensdag 4 juni 2003 15:21 +0200 Christoph Lehmann <lehmann at puk.unibe.ch> wrote:> what is the easiest way to get from > x > x1 x2 > [1,] 2 3 > [2,] 3 2 > [3,] 1 3 > [4,] 1 4 > > xbar1 > x1 x2 > [1,] 1.75 3 > [2,] 1.75 3 > [3,] 1.75 3 > [4,] 1.75 3 > > with the mean of the columns of x as values? >xbar1 <- tapply(as.vector(x), gl(2,4), mean); -- Paul Lemmens NICI, University of Nijmegen ASCII Ribbon Campaign /"\ Montessorilaan 3 (B.01.03) Against HTML Mail \ / NL-6525 HR Nijmegen X The Netherlands / \ Phonenumber +31-24-3612648 Fax +31-24-3616066
--On woensdag 4 juni 2003 15:21 +0200 Christoph Lehmann <lehmann at puk.unibe.ch> wrote:> what is the easiest way to get from > x > x1 x2 > [1,] 2 3 > [2,] 3 2 > [3,] 1 3 > [4,] 1 4 > > xbar1 > x1 x2 > [1,] 1.75 3 > [2,] 1.75 3 > [3,] 1.75 3 > [4,] 1.75 3 > > with the mean of the columns of x as values?xbar <- predict(lm(x ~ 1))