Description Usage Arguments Details Value Author(s) Examples
A convenience function for writing the names and values of objects to the session window (and/or to another object). Especially useful to keep track of variables within loops.
1 |
... |
Objects whose names and values are to be printed, separated by commas. Can also be a simple list. |
digits |
Number of digits to display for numeric objects. Defaults to
|
abbrev |
Number of characters to display for character objects.
Defaults to |
sep |
Character string that separates the objects that are printed |
verbose |
|
Input objects can be numeric, character, and/or logical. They can also be atomic or vectors. It will accept data frames and matrices without error, but the results won't be easily readable.
Invisibly returns a character string containing the names of the objects and their values
Landon Sego
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 | x <- 10
y <- 20.728923
z <- "This.long.string"
pvar(x, y, z)
pvar(x, y, z, digits = 2)
pvar(x, y, z, abbrev = 4)
pvar(x, y, z, digits = 2, abbrev = 4)
pvar(x, y, z, sep = ",")
# values can be vectors too
x <- 10:12
y <- c("This","That")
v2 <- pvar(x, y, verbose = FALSE)
v2
# Or a simple list
pvar(list(x = 1:2, y = "this", z = TRUE))
# Can be useful for keeping track of iterations in loops
for (i in 1:2) {
for (j in letters[1:2]) {
for (k in c("this","that")) {
pvar(i, j, k)
}
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.