Trying to reorder columns in my based on total blank and 'N/A' values.
ggplot(quality_melted, aes(x = Column, y = value, fill = variable)) +
geom_bar(stat = "identity") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
labs(title = "Data Quality Inspection: Blanks and 'N/A' Responses", x = "Columns", y = "Count")
Tried using something like x = reorder(Column, NA_blank_Count)
but that wasn't working for me. Sorry I cannot provide the visualization output; I'm working with sensitive data.
reorder()
works on factor onlyYou need to convert your Column as factor and you can actually define the order during the operation, like:
Now, if you plot, you should got the order starting with "Blank".