vectorShow {oce} | R Documentation |
Show Some Values From a List, Vector or Matrix
Description
This is similar to str()
, but it shows data at the first and last of the
vector, which can be quite helpful in debugging.
Usage
vectorShow(
v,
msg = "",
postscript = "",
digits = 5L,
n = 2L,
showNA = FALSE,
showNewline = TRUE
)
Arguments
v |
the item to be summarized. If this is a list of a vector of named
items, then information is provided for each element. Otherwise, information
is provided for the first and last |
msg |
optional character value indicating a message to show,
introducing the vector. If not provided, then
a message is created from |
postscript |
optional character value indicating an optional message to append at the end of the return value. |
digits |
for numerical values of |
n |
number of elements to show at start and end. If |
showNA |
logical value indicating whether to show the number
of |
showNewline |
logical value indicating whether to put a newline
character at the end of the output string. The default, TRUE, is
convenient for printing, but using FALSE makes more sense if
the result is to be used with, e.g. |
Value
A string ending in a newline character, suitable for
display with cat()
or oceDebug()
.
Author(s)
Dan Kelley
Examples
# List
limits <- list(low = 0, high = 1)
vectorShow(limits)
# Vector of named items
planktonCount <- c(phytoplankton = 100, zooplankton = 20)
vectorShow(planktonCount)
# Vector
vectorShow(pi)
# Matrix
vectorShow(volcano)
# Other arguments
knot2mps <- 0.5144444
vectorShow(knot2mps, postscript = "knots per m/s")
vectorShow("January", msg = "The first month is")