Hi, I’m a little confused on what to do in this coding situation and would appreciate some help!

I’m trying to create new columns in a dataframe (D) as a linear combination of the existing columns in that dataframe, given a vector of coefficients (v).

Basically: If I have a vector of Float64 numbers, v_i, and a 20 column data frame, D, of float64 values, how can I concatenate columns to the data frame D, where I am doing an element wise multiplication:

D[:New] = v_1*D_1 + v_2*D_2 + v_3*D_3 + … v_20*D_20 ; where D_i = ith column of D

So far I have started to write the function:

for i in 1:length(v)

D[:New] += v[i]*(D[:column_names_of_D[i]])

end

But I am unsure how to call the D[:column_names_of_D[i]]) part…