In R some functions can print information and return values, can the print be silenced?
For example:
print.and.return <- function() {
print(\"foo\
I know that I might be resurrecting this post but someone else might find it as I did. I was interested in the same behaviour in one of my functions and I just came across "invisibility":
It has the same use of return()
but it just don't print the value returned:
invisible(variable)
Thus, for the example given by @ayman:
print.and.return2 <- function() {
message("foo")
invisible("bar")
}