cbind.ts | R Documentation |
A replacement for the S3 method registered by package stats for
generic function cbind
and class ts
. It
sets column names following the rules employed by the internal default
method for cbind
. It exists to allow users to work around
\Sexpr[results=rd]{tools:::Rd_expr_PR(18583)}, which shows that the method in package stats employs
different and rather inconsistent rules. This function must be called
directly, as it is not registered as a method for cbind
.
## S3 method for class 'ts'
cbind(..., deparse.level = 1)
... |
vectors (including matrices), at least one inheriting from class
|
deparse.level |
an integer (0, 1, or 2) controlling how column names are determined
for untagged arguments that are not matrices, following the internal
default method for |
A “multiple time series” object, inheriting from class
mts
.
n <- 3L
x <- matrix(0, n, n, dimnames = list(NULL, LETTERS[seq_len(n)]))
y <- seq_len(n)
tsx <- ts(x)
tsy <- ts(y)
`~` <- identity
for (k in 0L:2L) {
cat(sprintf("k = %d:\n\n\n", k))
withAutoprint({
try(colnames(cbind ( x, y, deparse.level = k)))
try(colnames(cbind ( tsx, tsy, deparse.level = k)))
try(colnames(cbind.ts( tsx, tsy, deparse.level = k)))
try(colnames(cbind (~ x, ~ y, deparse.level = k)))
try(colnames(cbind (~tsx, ~tsy, deparse.level = k)))
try(colnames(cbind.ts(~tsx, ~tsy, deparse.level = k)))
})
cat("\n\n")
}
rm(`~`)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.