[R] Select maximum subset

Evgenia evgts at aueb.gr
Sun Dec 23 22:16:25 CET 2012


Suppose i have matrix z
id<-c(1,2,3,4,5)
a <- c(4, 3, 2, NA, 1)
b <- c(3, NA, 2, 7, 1)
c <-c(3, NA, NA, 7, NA)

z<- cbind(id,a, b,c)

     id  a  b  c
[1,]  1  4  3  3
[2,]  2  3 NA NA
[3,]  3  2  2 NA
[4,]  4 NA  7  7
[5,]  5  1  1 NA


I want to select those columns for which I have the smallest number of NA

In my example, these would be column1 and 2

since they give me 
4	3
2	2
1	1

My real example have alot of columns and I want to find and save  all
possible subsets 

Thanks, alot

Evgenia



--
View this message in context: http://r.789695.n4.nabble.com/Select-maximum-subset-tp4653845.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list