I have the following function that return just a print out with cat()
.
show_something <- function() {cat("foo\n")}
What I want to do is to capture the output fo that function into a variable as a string.
I tried this:
> x <- show_something()
foo
> x
NULL
>
As you can see x
return NULL. How can I get x
to capture foo
?