I have a function, such as Q = 4000-50P, written in R as
q1 <- function(p_)pmax(0,4000-50*p_)
and I want to rewrite the equation in terms of P, to get P = 80-(1/50)*Q, written in R as p1 <- function(q1_)pmax(0,80-(1/50)*q1_)
Is there a way for R to solve a function/equation for another variable? I want to tell R to solve the first equation in terms of p_. I can't seem to find any answers online. Thanks in advance!