2 4 6
1 4 6
na.trim(xx)
4 4 5
6 6 7
2 3 6
12 NA 16
Generic function for removing leading and trailing NAs.
na.trim(object, ...)
## Default S3 method:
na.trim(object, sides = c("both", "left", "right"),
is.na = c("any", "all"), maxgap = Inf, ...)
object
|
an object. |
sides
|
character specifying whether NAs are to be removed from both sides, just from the left side or just from the right side.
|
is.na
|
If "any" then a row will be regarded as NA if it has any NAs. If "all" then a row will be regarded as NA only if all elements in the row are NA. For one dimensional zoo objects this argument has no effect.
|
maxgap
|
maximum number of consecutive NAs to trim. Any longer gaps will be left unchanged.
|
…
|
further arguments passed to methods. |
An object in which leading and/or trailing NAs have been removed.
na.approx, na.contiguous, na.locf, na.omit, na.spline, stinterp, zoo