cor: Correlation computing for 'zoo' or 'zoocat' objects

Description Usage Arguments Value Examples

Description

This function is based on the function stats::cor. For cor.zoo and cor.zoocat, the equality of the index of x and y will be checked (if y is not NULL). For cor.zoocat, if y has one column, the result will be binded with the cattr table and a data frame will be returned.

Usage

1
2
3
4
5
6
7
cor(x, y = NULL, ...)

## S3 method for class 'zoo'
cor(x, y = NULL, ...)

## S3 method for class 'zoocat'
cor(x, y = NULL, ...)

Arguments

x

A zoo or zoocat object.

y

NULL or a zoo or zoocat object. If NULL, x will be used.

...

Other arguments for function stats::cor.

Value

a vector, matrix or data frame.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x <- zoo(c(1, 3, 2, 4, 5))
y <- zoo(c(12, 30, 2, 46, 5))
cor(x, y)

x <- matrix(1 : 20, nrow = 5)
colAttr <- data.frame(month = c(2, 3, 5, 6), name = 'x')
zc <- zoocat(x, order.by = 1991 : 1995, colattr = colAttr)
y <- zoo(c(3, 5, 4, 6, 3), order.by = 1991 : 1995)
cor(zc, y, method = 'kendall')
cor(zc, method = 'kendall')

zoocat documentation built on May 2, 2019, 10:22 a.m.