I have two sets of numbers, and I want to multiply them to produce a matrix.
Suppose each set of numbers contains 5 values, so I know my matrix should be 5^2=25 values.
#First allocate an empty matrix? mymat <- matrix(nrow=5, ncol=5) #Let's say these are the two sets of numbers set1 <- seq(1,5) set2 <- seq(6,10) #Set the row and col names of the matrix appropriately rownames(mymat) <- set1 colnames(mymat) <- set2
Next I just need to multiply columns and rows to fill in the values. I am reading online about
%*% but I can't seem to make it work across an entire matrix.
I'm trying to produce this: