[R] R WRONG CALCULATIONS - Please Help

Frank Schwidom schwidom at gmx.net
Mon Sep 14 20:45:16 CEST 2015


On Mon, Sep 14, 2015 at 04:11:57PM +0100, JORGE COLACO wrote:

> > X-mean
>      [,1] [,2] [,3] [,4] [,5] [,6]
> [1,] -0.8 -0.2  0.8 -1.2  0.8 -0.2
> [2,] -0.2  0.2  0.8  0.8  0.8 -1.2
> [3,] -1.2 -0.2 -0.8  0.8 -0.2  0.8
> [4,]  0.8  0.8 -1.2 -0.8 -0.2 -0.2
> [5,] -0.2 -0.2  0.8  0.8 -0.8  0.8
> >

try this:

X - mean[ col( X)]
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,] -0.8 -0.2  0.8 -1.2  0.8 -0.2
[2,]  0.2 -0.2  0.8  0.8  0.8 -1.2
[3,] -0.8 -0.2 -1.2  0.8 -0.2  0.8
[4,]  1.2  0.8 -1.2 -1.2 -0.2 -0.2
[5,]  0.2 -0.2  0.8  0.8 -1.2  0.8

Regards.

> Right Result Should Be:
> 
> ans =
>   -0.80000  -0.20000   0.80000  -1.20000   0.80000  -0.20000
>    0.20000  -0.20000   0.80000   0.80000   0.80000  -1.20000
>   -0.80000  -0.20000  -1.20000   0.80000  -0.20000   0.80000
>    1.20000   0.80000  -1.20000  -1.20000  -0.20000  -0.20000
>    0.20000  -0.20000   0.80000   0.80000  -1.20000   0.80000
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.



More information about the R-help mailing list