Check out sqrt(p_green(p_not_green))
In the way you've written this, you are saying "put the object p_not_green
into a function named p_green
". That is, when you follow a name with parentheses, R usually assumes you are trying to call a function. That's why you get the error "Error in p_green(p_not_green): could not find function "p_green"
"
I think you probably want to be applying some operator to these two objects, e.g. (p_green + p_not_green)
.
Also just to note our homework policy: FAQ: Homework Policy
But I think asking for hints as to how best to resolve issues with your approach to solving a homework problem, as Paul does, is usually cool.