I have a dataframe with multiple columns
col1|col2|col3|colA|colB|colC|Percent
1 1 1 2 2 2 50
Earlier I subset the columns and created a vector
ColAlphabet<-c("ColA","ColB","ColC")
What i want to do is take ColAlphabet and multiply it by Percent so in the end I have
col1|col2|col3|colA|colB|colC|Percent
1 1 1 1 1 1 50
We can use
mutate
withacross
. Specify the columns of interest wrapped withall_of
and multiply the columns with 'Percent'-output
data