[R] How to doulbe all the value on a matrix
Dieter Menne
dieter.menne at menne-biomed.de
Mon Jan 17 17:31:12 CET 2011
ADias wrote:
>
> Is there an expression to double the values of a matrix - without using a
> loop?
>
>
Why so complicated?
Dieter
> m = matrix(rep(1,20),nrow=4)
> m
[,1] [,2] [,3] [,4] [,5]
[1,] 1 1 1 1 1
[2,] 1 1 1 1 1
[3,] 1 1 1 1 1
[4,] 1 1 1 1 1
> m*3
[,1] [,2] [,3] [,4] [,5]
[1,] 3 3 3 3 3
[2,] 3 3 3 3 3
[3,] 3 3 3 3 3
[4,] 3 3 3 3 3
>
--
View this message in context: http://r.789695.n4.nabble.com/How-to-doulbe-all-the-value-on-a-matrix-tp3221213p3221231.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list