Produces a fully customizable object aware string with consecutive values separated by columns.
# S3 method for default
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 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 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 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), ...)
The object of length n
The string to return if n = 1
The string to return if n is in 2, 3, ..., nlots - 1
The string to return if n = 0
The string to return if n >= nlots
A count of the number of values to consider to be lots
A string of the conjunction to separate the last value by or NULL.
A string to bracket the values by.
A count of the total number of values required to use an ellipsis.
A flag indicating whether to use the Oxford comma (if conjunction).
A string of the object name.
Unused.
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'
# NOT RUN {
co(character())
x <- "fox"
co(x)
co(c(1,2,5))
co(1:10)
co(datasets::mtcars)
# }
Run the code above in your browser using DataLab