| hash {MIfuns} | R Documentation |
Any expression that generates output can be wrapped in a call to hash(). The usual output will be returned, with a hash character at the start of each line.
hash(x)
x |
an R expression |
This is useful for embedding the result of an expression in a script.
used for side effects
Don't "hash" an expression that directly or indirectly calls a function being
debugged. The debug output will be 'sunk' to a connection. If you get in
this situation, recover by typing sink(NULL) until output is restored.
Tim Bergsma
http://metruminstitute.org
function(x){
con <- file()
sink(con)
result <- try(x)
if(!inherits(result,"try-error"))print(result)
comments <- paste("#",readLines(con))
sink(NULL)
close(con)
writeLines(comments)
}