Matrices x Vector multiplication using R script


Hi guys!
i need little help to complete my assignment and R script that can make division like....

Agriculture Mining Industry Services Output
200 115 180 212 857
130 230 156 137 833
180 195 240 186 935
140 190 116 225 812

885 divided to each value of Agriculture column
than 833 divided to each value in Mining column
than 935 divided to each value in Industry column
than 812 divided to each value in Services column

so that final output will be like:
|0.2334| 0.1302| 0.1925 |0.2611|
|0.1517| 0.2605| 0.1668 |0.1687|
|0.2100| 0.2208| 0.2567 |0.2291|
|0.1634| 0.2152| 0.1241 |0.2771|

i will be thankfull


Hey, according to this forum's homework policy, this isn't the best place to ask a question like this.

Perhaps if you talked a little about what you've tried we can give you hints and tell you why that particular approach isn't working?


Hey dstandr

I'm sorry i didn't know that,

any hint will be helpful :smiley:


It's totally ok, you're not expected to know the rules. And I'd be really happy to help you, but two things first:

  1. Please put this in the format of a reproducible example ("reprex") so that it's clear exactly what you're asking. Right now I'm not sure if, for example, your table is in the form a data frame, data table, or matrix. I'm also not sure if there are any constraints on your task. Does it need to be vectorized or would a for loop be ok (there's a hint, if you want it).
  2. It's important for all of us who code in any language that we learn how to solve problems and get unstuck on our own. Please show us what attempts you've made to solve this problem and then we can help you from there.

Good luck :slight_smile: