Learn R Programming

heatmaply (version 0.7.1)

is.na10: Indicates which elements are missing (either 1 and 0)

Description

is.na10 is a helper function for creating heatmaps to diagnose missing value patterns. It is similar to is.na but instead of returning a logical TRUE/FALSE vector (or matrix) it returns a numeric 1/0 output. This enables the heatmaply function to be used on the data.

Usage

is.na10(x, ...)

Arguments

x
a vector, matrix or data.frame.
...
not used.

Value

Returns a numeric (instead of a logical) variable/matrix of 1 (missing) or 0 (not missing) values (hence the name is.na10) while still presering the attributes resulted from running is.na.These are useful for funnelling into a heatmap (see the examples).

See Also

is.na

Examples

Run this code
## Not run: 
# x <- mtcars
# x <- data.frame(x)
# x$am <- factor(x$am)
# x$vs <- factor(x$vs)
# set.seed(2017-01-19)
# x[sample(nrow(x))[1:6],sample(ncol(x))[1:6]] <- NA
# 
# 
# # nice grey colors from here: https://github.com/njtierney/visdat/blob/master/R/vis_miss_ly.R
# x %>% is.na10 %>% heatmaply( colors = c("grey80", "grey20"), dendrogram = "none")
# x %>% is.na10 %>% heatmaply( colors = c("grey80", "grey20"), k_col = 2, k_row = 2)
# 
# ## End(Not run)

Run the code above in your browser using DataLab