I have a list of column names:
list = {"col1", "col2", "col3"}
and a dataset ds
. I want to add a new column to ds
that contains the sum of the columns listed in list
. As suggested here, I could do:
ds[All, <| #, "colnew" -> #col1 + #col2 + #col3 |> &]
But I cannot list the column names by hand, because the list may be very large, or I might not know the names of the columns a priori.