R: Print a string which has been intepolated with variables

qqcat {GetoptLong} | R Documentation

## Print a string which has been intepolated with variables

### Description

Print a string which has been intepolated with variables

### Usage

    qqcat(text, envir = parent.frame(), code.pattern = NULL, file = "",
        sep = " ", fill = FALSE, labels = NULL, append = FALSE, cat_prefix = NULL,
        strwrap = qq.options("cat_strwrap"), strwrap_param = list())

### Arguments

`text` | text string in which variables are marked with certain rules
`envir` | environment where to look for those variables
`code.pattern` | pattern of marks for the variables
`file` | pass to `cat`
`sep` | pass to `cat`
`fill` | pass to `cat`
`labels` | pass to `cat`
`append` | pass to `cat`
`cat_prefix` | prefix string. It is prior than `qq.options(cat_prefix)`.
`strwrap` | whether call `strwrap` to wrap the string
`strwrap_param` | parameters sent to `strwrap`, must be a list

### Details

This function is a shortcut of

        cat(qq(text, envir, code.pattern), ...)

Additionally, you can add global prefix:

        qq.options("cat_prefix" = "[INFO] ")
        qq.options("cat_prefix" = function(x) format(Sys.time(), "[%Y-%m-%d %H:%M:%S] "))
        qq.options("cat_prefix" = NULL)

You can also add local prefix by specifying `cat_prefix` in `qqcat`.

        qqcat(text, cat_prefix = "[INFO] ")

Please refer to `qq` to find more details.

### Author(s)

Zuguang Gu <z.gu@dkfz.de>

### Examples

    a = 1
    b = "text"
    qqcat("a = @{a}, b = '@{b}'\n")
    qqcat("a = `a`, b = '`b`'\n", code.pattern = "`CODE`")

    qq.options("cat_prefix" = function(x) format(Sys.time(), "[%Y-%m-%d %H:%M:%S] "))
    qqcat("a = @{a}, b = '@{b}'\n")
    Sys.sleep(2)
    qqcat("a = @{a}, b = '@{b}'\n")
    qq.options(RESET = TRUE)

[Package GetoptLong version 0.1.7 Index]