interpolate | R Documentation |
Missing (NA
) values in a CRHMr obs data frame are filled by
linear or spline interpolation. The user can set the maximum gap length (in time steps)
allowed to be filled. Note that this function will NOT interpolate RH or
precipitation values.
interpolate(
obs,
varcols = 1,
methods = "linear",
maxlength = 5,
quiet = TRUE,
logfile = ""
)
obs |
Required. The CRHMr data frame of obs values. |
varcols |
Optional. A vector containing the columns to be imputed in the obs data frame, not including the datetime. If not specified, defaults to the first column. |
methods |
Optional. A vector containing the methods to be used for interpolation for each of the variables. Currently supported methods are linear and spline. The default is to use linear interpolation. If fewer methods than columns are specified, the methods are recycled. |
maxlength |
Optional. The maximum gap length to be interpolated. Defaults to 5 time steps. |
quiet |
Optional. Suppresses display of messages, except for errors. If you
are calling this function in an R script, you will usually leave |
logfile |
Optional. Name of the file to be used for logging the action. Normally not used. |
If successful, returns a modified version of the obs
data frame.
The missing values in the specified data frame are replaced by interpolated values.
If unsuccessful, returns an error.
In addition to the usual notation in the logfile, this function also
writes a separate logfile which summarises the original obs data frame, and the
new infilled data frame. The summaries are also printed to the screen, if
quiet=FALSE
. The logfile also contains a complete listing of the source
of each value in the infilled data frame. Each value is listed as being
original (unmodified from the primary obsframe), linear interpolation
(infilled by linear interpolation), spline interpolation
(infilled by spline interpolation) or NA (missing).
Kevin Shook
impute
distributeP
## Not run:
v.filled <- interpolate(v, c(1, 3))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.