Home > OS >  How Do I add column to data frame that uses a mathematical equation with variables from the existing
How Do I add column to data frame that uses a mathematical equation with variables from the existing

Time:08-25

  1. I have df that contains columns "Value" and "Max Value"
  2. I add a column to my df using mutate()
  3. I need the new column to output based on the equation output=119[(Max Value/value)-1]^1.231

CodePudding user response:

We may do

library(dplyr)
df <- df %>%
    mutate(output = 119 * ((`Max Value`/Value)-1)^1.231)
  • Related