@sirishan wrote:
Is there any option to plot the missing values in R ? if yes, kindly help me out.
I googled it and found the below code, but couldn't understand the X2,X1 and Value in this code. Can anyone explain me asap as i do have a presentation.
And let’s explore the missing data using my own ggplot function:
A function that plots missingness
requires
reshape2
library(reshape2)
library(ggplot2)ggplot_missing <- function(x){
x %>%
is.na %>%
melt %>%
ggplot(data = .,
aes(x = X2,
y = X1)) +
geom_raster(aes(fill = value)) +
scale_fill_grey(name = "",
labels = c("Present","Missing")) +
theme_minimal() +
theme(axis.text.x = element_text(angle=45, vjust=0.5)) +
labs(x = "Variables in Dataset",
y = "Rows / observations")
}Let’s test it out
ggplot_missing(df)
Posts: 1
Participants: 1