glimpse_na | R Documentation |
Quick indication of the amount and location of missing values.
The function uses na_status
to print the missing values, but
returns the original x
(invisibly) and therefore can be used in an imputation pipeline
to peek at the NA's status.
glimpse_na(x, show_only_missing = TRUE, ...) lhs %?>% rhs
x |
an R object caryying data (e.g. |
show_only_missing |
if |
... |
arguments passed to |
lhs |
left hand side of pipe |
rhs |
right hand side of pipe |
glimpse_na
is especially helpful when interactively adding imputation methods.
glimpse_na
is named after glimpse
in dplyr
.
Operator %?>%
is syntactic sugar: it inserts a glimpse_na
in
the pipe.
irisNA <- iris irisNA[1:3,1] <- irisNA[3:7,2] <- NA # How many NA's? na_status(irisNA) # add an imputation method one at a time iris_imputed <- irisNA |> glimpse_na() # same as above # ok, glimpse_na says "Sepal.Width" has NA's # fix that: iris_imputed <- irisNA |> impute_const(Sepal.Width ~ 7) |> glimpse_na() # end NA # Sepal.Length is having NA's iris_imputed <- irisNA |> impute_const(Sepal.Width ~ 7) |> impute_cart(Sepal.Length ~ .) |> glimpse_na() # end NA # in an existing imputation pipeline we can peek with # glimpse_na or %?>% iris_imputed <- irisNA |> glimpse_na() |> # shows the begin NA impute_const(Sepal.Width ~ 7) |> glimpse_na() |> # after 1 imputation impute_cart(Sepal.Length ~ .) |> glimpse_na() # end NA # or iris_imputed <- irisNA %?>% impute_const(Sepal.Width ~ 7) %?>% impute_cart(Sepal.Length ~ .) na_status(iris_imputed)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.