我正在使用VIM库来尝试查看我丢失的数据的模式。从我的原始数据集中,我创建了一个子集,如下所示:
newdata<- df[c(11,17:45)] #This makes a new dataframe with columns 11 and 17 through 45 (to get the number of column type (names(dataframe)))
newdata1<-newdata[which(df$variable1=='1' |
df$variable1=='2'),] #This makes a new dataframe of df including only variable 1 = 1 and variable 1 = 2
library(VIM)
## for missing values
miss <- aggr(newdata1)
newdata1
attach(newdata1)
plot(newdata1, sortVars = FALSE,
sortCombs = TRUE, axes = TRUE, combined = FALSE, labels= TRUE)我的输出有问题,我看不到x轴上的变量。

我希望能够看到缺少的变量的名称。
我的数据帧是这样的:
Result question1 question2 question3 question4 question5
1 1 1 1 1 1
1 2 1 1 2 4
2 1 1 3 1 2
1 1 2 1 3 1
2 NA 1 2 2 1
1 1 1 NA 2 2
1 NA NA 1 3 1
1 1 4 1 3 1
2 2 NA NA 3 2发布于 2016-11-18 10:16:23
miss <- aggr(newdata1, col=c('navyblue','red'),
numbers=TRUE, sortVars=TRUE,
labels=names(newdata1), cex.axis=.5,
gap=3, ylab=c("Missing data","Pattern"))您可以尝试上面的代码。希望你能得到x轴上的标签。
https://stackoverflow.com/questions/39163283
复制相似问题