I have 2 two-dimensional matrices which I try to combine into 1. There are 3 common sets in each matrix, voyages barges and category's. I have an binary matrix which assigns barges to voyages, and I have a matrix which states the capacity of different categorys of cargo per barge. Now what I try to create is a table which gives the capacity per voyage based on which barge is assigned to it. I made some example data, my real data is tables and data frames in R;
table 1: capacity of category c for barge b
table 2: = 1 if barge b goes on voyage v
Now based on these 2 tables I want to get a table, which gives me the cap of each voyage, as follows;
table 3: output table
table 1 and 2 are both of type matrix in R
After I work the data I import it in python, so if someone knows how to do it there instead of in R, that would work fine as well.
Regards
You can try tcrossprod
tcrossprod(tbl1,tbl2)