I am an only very occasional R user and this is the first time I am asking a question regarding R here or anywhere else online, so I apologize beforehand if anything remains unclear.
I have a numeric dataframe with about 100 columns in each of which there is the same number (number 10 in this example) that needs to be multiplied with a value from a numeric vector, which is specific to each column. I am completely stuck and would appreciate any help.
Here is a simplified example:
df
V1 V2 V3
1 0 0 2
2 1 0 2
3 0 0 1
4 0 0 2
5 0 0 1
6 10 0 1
7 0 0 1
8 0 0 2
9 0 10 2
10 0 0 2
11 10 0 1
12 0 0 10
13 1 2 1
14 0 0 2
15 0 0 0
16 0 1 2
17 1 0 10
18 1 1 1
19 0 0 1
20 0 0 2
The corresponding vector would look as follows:
V
v1 v2 v3
0.01256117 0.03037231 0.55444079
So, the values "10" of df column V1 would need to be multiplied by value v1 of vector V, the values "10" of df column V2 by the value v2 of vector V, etc.
Any help is very much appreciated!