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_1D_1 + v_2D_2 + v_3D_3 + … v_20D_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]])
But I am unsure how to call the D[:column_names_of_D[i]]) part…