Learn R Programming

lfstat (version 0.9.4)

as.lfobj: Coerce to class lfobj

Description

Functions to check if object is of class lfobj or coerce it if possible. Currently, only methods for zoo and xts exist.

Usage

as.lfobj(x, ...) is.lfobj(x) "as.lfobj"(x, ...) "as.lfobj"(x, ...)

Arguments

x
any R object.
...
additional arguments to be passed to or from methods.

Value

An object of class lfobj.

See Also

createlfobj

Examples

Run this code

data(ngaruroro)
is.lfobj(ngaruroro)

# coerce zoo object to class lfobj
z1 <- zoo(1:10, order.by = seq(Sys.Date(), length.out = 10, by = "days"))
as.lfobj(z1, hyearstart = 5)

# coerce xts object to class lfobj
xts1 <- xts(1:10, order.by = seq(Sys.Date(), length.out = 10, by = "days"))
as.lfobj(xts1, hyearstart = 5)



Run the code above in your browser using DataLab