Use dynamic name for new column/variable in `dplyr`
Since you are dynamically building a variable name as a character value, it makes more sense to do assignment using standard data.frame indexing which allows for character values for column names. For example: multipetal <- function(df, n) { varname <- paste(“petal”, n , sep=”.”) df[[varname]] <- with(df, Petal.Width * n) df } The mutate function … Read more