Update for more attempted clarity: I did investigate both my books and many sites and I'm sure I simply didn't search the right key words.
I created a function that multiplies matrices times vectors (full matrix multiplication) which you'll see in the code. So far that's fine and working. I input my function and its arguments:
m<- matrix(1:9, nrow= 3, ncol=3)
f <- function(x,y,z) {(as.vector(y)%*%x%*%as.vector(y))*z}
f(m,rep(1,3),2)
This outputs: [,1] [1,] 90
x and y remain constant but z will vary.
So I want use a vector to get multiple outputs.
z<- as.vector(1,2,3)
I've tried the apply function like so:
apply (c(rep(m,3),rep(1,3),rep(2,3)),1,f)
But that produces an error.
Error: unexpected ',' in "apply ((rep(m,3),"
So my question is how can you do matrix multiplication and then multiply that output to each element in a vector for plotting?
Also I realize that one answer is to simply create a function that performs the matrix multiplication first and then another that multiplies that result times a scalar but can we assume that isn't available as a solution.
Thanks in advance for any help