Let's say we have the following function:
foo <- function(x)
{
line1 <- x
line2 <- 0
line3 <- line1 + line2
return(line3)
}
And that we want to change the second line to be:
line2 <- 2
How would you do that?
One way is to use
fix(foo)
And change the function.
Another way is to just write the function again.
Is there another way? (Remember, the task was to change just the second line)
What I would like is for some way to represent the function as a vector of strings (well, characters), then change one of it's values, and then turn it into a function again.