Description Usage Arguments Details See Also Examples
View source: R/helper_functions.R
Depending on the parent frame's "verbose" logical object state (T/F), cat R object(s).
1 |
... |
Things to cat |
sep |
a character string to separate each element. |
bypass |
logical. If bypass == T print regardless of other factors. |
Outputs the objects, concatenating the representations. cat performs much less conversion than print.
vprint
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ## Not run:
dog <- ("dog")
# With no verbose object in the env, and bypass not true, vcat does nothing
vcat(dog)
# Dummy function with verbose as an argument to show "local" environment interactions
foo <- function(verbose = FALSE){
vcat(dog)
}
# Create a global variable verbose set to TRUE
verbose <- T
# vcat and foo() now both print the dog object, even though foo's local verbose variable is false.
# i.e. a global verbose veriable will take precedence over a local one
vcat(dog)
foo(verbose = FALSE)
# With the global verbose object set to FALSE, a direct vcat call does nothing, and if the foo function
# is given TRUE for it's local verbose object, then the 'dog' object is still not printed. As above,
the global variable takes precedence.
verbose <- F
vcat(dog)
foo()
foo(verbose = TRUE)
# However if there is no global verbose variable, a local variable will cause it to print
rm(verbose)
foo(verbose = TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.