impute | R Documentation |
This function fills in missing (NA
) values in a CRHMr obs
data frame by imputation. The primary values are the data that will be infilled. The
secondary values are those used to fill in the gaps. The secondary values are adjusted
using the specified multipliers (regression slopes) and offsets (regression intercepts).
impute(
primaryObs,
primaryCols = 1,
secondaryObs,
secondaryCols = 1,
multipliers = 1,
offsets = 0,
quiet = TRUE,
logfile = ""
)
primaryObs |
Required. The primary CRHMr data frame of obs values. |
primaryCols |
Optional. A vector containing the columns to be imputed in the primary data frame, not including the datetime. If not specified, defaults to the first column. |
secondaryObs |
Required. The secondary CRHM obs data frame. |
secondaryCols |
Optional. A vector containing the columns to be imputed in the secondary data frame, not including the datetime. If not specified, defaults to the first column. |
multipliers |
Optional. A vector of multipliers applied to secondary observations.
These may be obtained using the regress function. The default value is |
offsets |
Optional. A vector of offsets added to secondary observations. These may
be obtained using the regress function. The default value is |
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 primaryObs
data frame.
The missing values in the primary data frame are replaced by corresponding values from
the secondary data frame, after adjustment using the specified multipliers and offsets.
If unsuccessful, returns an error.
In addition to the usual notation in the logfile, this function also writes a
separate logfile which summarizes the primaryObs 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 primaryObs
data frame), imputed (derived from the adjusted values of the secondaryObs
data frame) or NA (missing).
Kevin Shook
interpolate
regress
distributeP
## Not run:
v.filled <- impute(
veg, c(1, 2, 3), st,
c(2, 3, 1), c(0.895, 0.708, 1.1209), c(-0.8128, 0.0607, 9.005)
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.