Suppose I have:
test <- function(x) x + 1
test
function(x)
x + 1
I would like to somehow save the output produced by invoking test to a string (i.e. the function declaration) but can't think of a way to do it.
You are looking for capture.output.
> z=paste(capture.output(test), collapse = " ")
> z
[1] "function(x) x + 1"
print.yourclass methods, but I've never seen that for a standalone function.
"x + 1"test. Something likedeparse(test)