2016-08-26 6 views
0

VIMライブラリを使用して、欠落しているデータのパターンを表示しようとしています。私は、私はx軸上の変数を見ていないです、私の出力とのトラブルを抱えています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) 

:私の元のデータセットから、私は次のようにサブセットを作りました。

missing values per variable

私は不足している変数の名前を見ることができるようにしたいです。あなたは上記のようなコードを試すことができ

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 

答えて

1
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軸上のラベルを取得することを望みます。

関連する問題