I have iris
dataframe. I want to add columns "log_Sepal.Length" and "log_Sepal.Width" which are result of applying log to "Sepal.Length" and "Sepal.Width". I tried:
iris %>%
mutate_at(.vars = vars(names(.)[str_detect(names(.), "Sepal")] ), .funs = c("identity", "log"))
but the data frame I Want is :
iris$log_Sepal.Length <- log(iris$Sepal.Length)
iris$log_Sepal.Width <- log(iris$Sepal.Width)
iris
is that possible with mutate_at
?