co {err} | R Documentation |
Customizable Object Aware String
Description
Produces a fully customizable object aware string with consecutive values separated by columns.
Usage
## Default S3 method:
co(object, one = "%o has %n value%s: %c",
some = one, none = gsub(": ", "", some), lots = some, nlots = 10,
conjunction = NULL, bracket = "", ellipsis = nlots,
oxford = FALSE, object_name = substitute(object), ...)
## S3 method for class 'character'
co(object, one = "%o has %n value%s: %c",
some = one, none = gsub(": ", "", some), lots = some, nlots = 10,
conjunction = NULL, bracket = "'", ellipsis = nlots,
oxford = FALSE, object_name = substitute(object), ...)
## S3 method for class 'factor'
co(object, one = "%o has %n value%s: %c",
some = one, none = gsub(": ", "", some), lots = some, nlots = 10,
conjunction = NULL, bracket = "'", ellipsis = nlots,
oxford = FALSE, object_name = substitute(object), ...)
## S3 method for class 'data.frame'
co(object, one = "%o has %n column%s\n%c",
some = one, none = none, lots = some, nlots = 10,
conjunction = NULL, ellipsis = nlots, oxford = FALSE,
object_name = substitute(object), ...)
Arguments
object |
The object of length |
one |
The string to return if |
some |
The string to return if n is in |
none |
The string to return if |
lots |
The string to return if |
nlots |
A count of the number of values to consider to be lots |
conjunction |
A string of the conjunction to separate the last value by or NULL. |
bracket |
A string to bracket the values by. |
ellipsis |
A count of the total number of values required to use an ellipsis. |
oxford |
A flag indicating whether to use the Oxford comma (if conjunction). |
object_name |
A string of the object name. |
... |
Unused. |
sprintf
-like types
The following sprintf
-like types can be used in the custom messages:
c
the object as a comma separated list (produced by a
cc
function)n
the length of the object
o
the name of the object
s
's' if n != 1 otherwise ”
r
'are' if n != 1 otherwise 'is'
See Also
Examples
co(character())
x <- "fox"
co(x)
co(c(1,2,5))
co(1:10)
co(datasets::mtcars)