I want to dynamically mutate a data set using an arithmetical expression in R. I tried following without success.Appreciate some help.
newCol <- 'newCol=gear+wt'
mutate(mtcars,!!newCol) ## This inserted a column newCol=gear+wt
mutate(mtcars,!!sym(newCol)) ## THis gives an error
'Error in mutate_impl(.data, dots) : Binding not found: newCol=gear+wt.'