Apply Function

Share:

Description

Apply a function to the rows or columns of an fts object

Usage

1
2
column.apply(x, FUN, ...)
row.apply(x, FUN, ...)

Arguments

x

An Fts object

FUN

function to be applied

...

further arguments to function

Value

an Fts object or vector depending on the fuction type

Author(s)

Whit Armstrong

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x <- fts(index=seq(from=Sys.Date(),by="months",length.out=24),data=1:24)
y <- fts(index=seq(from=Sys.Date(),by="months",length.out=24),data=1:24)

z <- cbind(x,y)

## returns vector
z.col.sum <- column.apply(z,sum)

## returns fts
z.row.sum <- row.apply(z,sum)