fill.missing | R Documentation |
Fill missing entries in an xts object using nalocf
or, alternatively, with an constant value
fill.missing(
x,
start = NULL,
end = NULL,
steps = "hour",
fill = TRUE,
na.value = NA
)
x |
an xts object |
start |
NULL or an POSIXct object. If NULL, the first index of x will be used |
end |
NULL or an POSIXct object. If NULL, the last index of x will be used |
steps |
increment of the sequence. See ‘Details’ |
fill |
logical. If TRUE missing entries are filled using |
na.value |
numeric or NA. Used for filling missing entries if fill == FALSE |
steps can be a character string, containing one of "sec", "min", "hour", "day", "DSTday", "week", "month", "quarter" or "year". Default is "hour"
an xts object
Simon Frey
missing.steps
data("runoff")
# delete a row to make the time series irregulat
runoff.missing <- runoff[-4,]
# fill missing timesteps
runoff.filled <- fill.missing(runoff.missing)
### fill with -0.01
runoff.filled <- fill.missing(runoff.missing, fill = FALSE, na.value = -0.01)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.