| txt_sprintf | R Documentation |
NA friendly version of sprintfDoes the same as the function sprintf except that if
in ... NA values are passed, also NA values are returned instead of being replaced by the character string 'NA'.
txt_sprintf(fmt, ...)
fmt |
a character vector of format strings, which will be fed on to |
... |
values to be passed into |
The same as what sprintf returns:
a character vector of length that of the longest input in ....
Except, in case any of the values passed on to ... are NA,
the corresponding returned value will be set to NA for that element of the vector.
See the examples to see the difference with sprintf
sprintf
sprintf("(w-1):%s", c("xyz", NA, "abc"))
txt_sprintf("(w-1):%s", c("xyz", NA, "abc"))
sprintf("(w-1):%s_%s", c("xyz", NA, "abc"), c(NA, "xyz", "abc"))
txt_sprintf("(w-1):%s_%s", c("xyz", NA, "abc"), c(NA, "xyz", "abc"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.