summary.imputation | R Documentation |
print and summary method for "imputation" class.
## S3 method for class 'imputation'
summary(object, ...)
object |
an object of class "imputation", usually, a result of a call to imputate_na() or imputate_outlier(). |
... |
further arguments passed to or from other methods. |
summary.imputation() tries to be smart about formatting two kinds of imputation.
imputate_na
, imputate_outlier
, summary.imputation
.
# Generate data for the example
heartfailure2 <- heartfailure
heartfailure2[sample(seq(NROW(heartfailure2)), 20), "platelets"] <- NA
heartfailure2[sample(seq(NROW(heartfailure2)), 5), "smoking"] <- NA
# Impute missing values -----------------------------
# If the variable of interest is a numerical variables
platelets <- imputate_na(heartfailure2, platelets, yvar = death_event, method = "rpart")
summary(platelets)
# If the variable of interest is a categorical variables
smoking <- imputate_na(heartfailure2, smoking, yvar = death_event, method = "rpart")
summary(smoking)
# Impute outliers ----------------------------------
# If the variable of interest is a numerical variable
platelets <- imputate_outlier(heartfailure2, platelets, method = "capping")
summary(platelets)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.