Description Usage Arguments Details Value Examples
The methods generate key-value pairs as character strings.
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 | pgfvalue(x, ...)
## S4 method for signature 'character'
pgfvalue(x, ...)
## S4 method for signature 'numeric'
pgfvalue(x, ...)
## S4 method for signature 'logical'
pgfvalue(x, ...)
## S4 method for signature 'POSIXt'
pgfvalue(x, ...)
## S4 method for signature 'Date'
pgfvalue(x, ...)
## S4 method for signature 'missing'
pgfvalue(x, ...)
## S4 method for signature 'list'
pgfvalue(x, ...)
## S4 method for signature 'pgfvalue'
pgfvalue(x, ...)
## S4 method for signature 'pgfkeyvalue'
pgfvalue(x, ...)
pgfkeyvalue(...)
|
x |
an object that can be coerced to a key-value pair; See signatures on methods for available object classes. |
... |
additional parameters, these can be named or unnamed, see details |
All arguments (x
as well as additional arguments ...
)
can be either named, i.e. key = value
or unnamed, i.e. key
.
If an unnamed argument is a named vector (or list) itself it will be
expanded to named arguments.
For x
a character any special characters will be escaped,
using escape_latex
. If x
contains special charcaters
that should remain unescaped (e.g. if value contains LaTeX commands), the
class of x
should be set to "pgfvalue"
explicitely before
calling pgfvalue()
, see Examples.
Logical values are given as true
or false
.
Lists can be nested. An unnamed list element is expanded to its (named or unnamed) entries. For a named element, the value is pasted to a single character with its values separated by a comma. The values (if named) are prepended by the values name and an equal sign. If the value contains a comma or an equal sign, it is masked with curly brackets.
The methods pgfvalue()
return an object of S3 class
pgfvalue
. It contains a character string of key-value pairs. If a
name is given, it is the key's name and the entry is the corresponding
value. If no name is given, the entry contains the key itself.
The function pgfkeyvalue()
returns an object of S3 class
pgfkeyvalue
. The structure of this class is the same as for class
pgfvalue
except for a different way of printing output (see
knit_print
for details).
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 32 33 34 35 | ## unnamed arguments
pgfvalue('key 1', 'key 2')
## named arguments
pgfvalue(key_1 = 'value 1', key_2 = 'value 2')
## named vector
pgfvalue(c(key_1 = 'value 1', key_2 = 'value 2'))
## escaping special character
x <- c(key_1 = 'value_1', key_2 = '\\command{argument}')
pgfvalue(x)
class(x) <- 'pgfvalue'
pgfvalue(x)
## numeric values
pgfvalue(num_1 = 1.3, num_2 = 12.23)
## logical values
pgfvalue(bool = TRUE)
## POSIXt values
pgfvalue(start = as.POSIXct('2016-04-01'), end = Sys.time())
## simple list as unnamed argument
pgfvalue(list(num_key = 12.3, log_key = TRUE, chr_key = 'text value'))
## simple lists as named arguments
pgfvalue(list_1 = list(num = 2, val = 'text'),
list_2 = list(date = Sys.Date(), description = 'current date'))
## nested lists
pgfvalue(list_1 = list(num = 2, val = 'text',
list_2 = list(date = Sys.Date(), description = 'current date')))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.