I have
mat<-matrix(1:12,3)
vect<-c(2,2,2)
How can I multiply each column by the vector in order to obtain:
2, 8, 14, 20
4, 10, 16, 22
6, 12, 18, 24
I have
mat<-matrix(1:12,3)
vect<-c(2,2,2)
How can I multiply each column by the vector in order to obtain:
2, 8, 14, 20
4, 10, 16, 22
6, 12, 18, 24
Copyright © 2021 Jogjafile Inc.
The vector
vect
is recycled by column. Better to experiment with different values to see the process.