Is there a analog of complete.cases for variables in R? -


here example illustration:

x = data.frame(x1=1:3, x2=2:4, x3=3:5) x #   x1 x2 x3 # 1  1  2  3 # 2  2  3  4 # 3  3  4  5 x[2, 1] = na x[3, 2] = na complete.cases(x) # [1]  true false false x[complete.cases(x), , drop=false] #   x1 x2 x3 # 1  1  2  3 

what if instead complete cases, want filter complete variables (columns)? in example above should like:

x[,3,drop=false] #   x3 # 1  3 # 2  4 # 3  5 

or this:

 x[, complete.cases(t(x)), drop=false] # tks simon 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -