hash {MIfuns}R Documentation

Supply comment characters with output

Description

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.

Usage

hash(x)

Arguments

x an R expression

Details

This is useful for embedding the result of an expression in a script.

Value

used for side effects

Warning

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.

Author(s)

Tim Bergsma

References

http://metruminstitute.org

See Also

file, sink

Examples

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)    
 }

[Package MIfuns version 3.2.9 Index]