My question if very much like a previous question (Remove rows with NAs (missing values) in data.frame). I would like to filter my matrix in such a way that all the column with just NA's will be gone. I want to keept the column with consist of a mixture of NA's and numbers. So in the example below, I would like to get rid of the columns named mmul and cfam and keep the rest.
gene hsap mmul mmus rnor cfam
1 ENSG00000208234 0 NA NA NA NA
2 ENSG00000199674 0 NA 2 2 NA
3 ENSG00000221622 0 NA NA NA NA
4 ENSG00000207604 0 NA NA 1 NA
5 ENSG00000207431 0 NA NA NA NA
6 ENSG00000221312 0 NA 2 3 NA
I want my new matrix to look like this:
gene hsap mmus rnor
1 ENSG00000208234 0 NA NA
2 ENSG00000199674 0 2 2
3 ENSG00000221622 0 NA NA
4 ENSG00000207604 0 NA 1
5 ENSG00000207431 0 NA NA
6 ENSG00000221312 0 2 3