Learn R Programming

fts (version 0.9.9.2)

apply: Apply Function

Description

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

Usage

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

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab