I have 3 vector: a (101 by 45), b (101 by 45) and k (1 by 45) to be manipulated to A+B*K^T where A is rep(a,45)
, B is rep(b,45)
and K is t(matrix(rep(k,45),ncol=45))
I have a matlab background and see everything as matrices, this view don't seem to be best for R. I struggle to adapt and have created following script that I'm sure can be much improved
nof=45
A = matrix(rep(a,nof),ncol=nof)
B = matrix(rep(b,nof),ncol=nof)
K = t(matrix(rep(k,nof),ncol=nof))
mf <- A+B%*%K
plot(mf)
Can this be written in more R fashion?