r – Graph a function within a function that has known values given for that function
I am creating a function I have set values, a, b, c, d = NULL.
5a + 2b + 15c/9d = e
Then I am trying to graph that within the function so that someone else can plug in the known values and create a graph based on d.
f <- function (a, b, c, d = NULL){
a = a
b = b
c = c
e<- 5a + 2b + 15c/9d
curve (e, from -5, to = 2)
}
I expect a graph that plugs the a for a, b for b, c for c, and creates a graph of various d of (d, e) on a specific range.
The problem is that it doesn’t recognize that a = a, b = b, c=c; so that I can then calculate the e from the given equation. Essentially, I am giving values from the function and their all null values despite that I am naming them.
Read more here: Source link
