txt_sprintf {crfsuite}R Documentation

NA friendly version of sprintf

Description

Does 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'.

Usage

txt_sprintf(fmt, ...)

Arguments

fmt

a character vector of format strings, which will be fed on to sprintf

...

values to be passed into fmt, the ... will be passed on to sprintf

Value

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

See Also

sprintf

Examples

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"))

[Package crfsuite version 0.4.2 Index]