na.trim {zoo} | R Documentation |
Generic function for removing leading and trailing NA
s.
na.trim(object, ...) ## Default S3 method: na.trim(object, sides = c("both", "left", "right"), is.na = c("any", "all"), ...)
object |
an object. |
sides |
character specifying whether |
is.na |
If "any" then a row will be regarded as |
... |
further arguments passed to methods. |
An object in which leading and/or trailing
NA
s have been removed.
na.approx
, na.contiguous
, na.locf
, na.omit
, na.spline
, stinterp
, zoo
# examples of na.trim x <- zoo(c(1, 4, 6), c(2, 4, 6)) xx <- zoo(matrix(c(1, 4, 6, NA, 5, 7), 3), c(2, 4, 6)) na.trim(x) na.trim(xx) # using na.trim for alignment # cal defines the legal dates # all dates within the date range of x should be present cal <- zoo(,c(1, 2, 3, 6, 7)) x <- zoo(c(12, 16), c(2, 6)) na.trim(merge(x, cal))