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.

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to