以下の関数を使用して欠損値をプロットしようとしています。ggplot2を使用して欠損値をプロットする
Don't know how to automatically pick scale for object of type data.frame. Defaulting to continuous. Error: Aesthetics must be either length 1 or the same as the data (65507): fill, x, y'
library(reshape2)
library(ggplot2)
library(dplyr)
ggplot_missing <- function(x){
x %>%
is.na %>%
melt %>%
ggplot(data = .,
aes(x ,
y)) +
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")
}
ggplot_missing(productholding)
任意のアイデア:私は、このエラーメッセージが表示されますか?
エラーメッセージがそれを言います - ベクトル値の長さは、1(すべて同じ値)またはシリーズの長さと同じである必要があります。 dfが正しく溶けているかどうか見てください... –
再現可能な例を提供すると、他の人があなたを助けやすくなります。 – elevendollar