.
can create a new variable called Revenue which is defined as Price * Quantity. df %>% mutate(Revenue = Price * Quantity) %>% arrange(desc(Revenue)) Let’s create our linear model object for Quantity as a function of Price and find our parameters. (model <- lm(Quantity ~ Price, df)) # Coefficients: #