Skip to content
Prev 295161 / 398506 Next

removing only rows/columns with "na" value from square ( symmetrical ) matrix.

Hi

You can do it by hand and remove row/col with max number of NA values.

rem<-which.max(colSums(is.na(M)))
M1<-M[-rem, -rem]
rem<-which.max(colSums(is.na(M1)))
M2<-M1[-rem, -rem]
M2
     1   2  3   4  5   7   8  10  11  12
1    0 143 92 134 42 123  40 107  49  93
2  143   0 77   6 99  46  47 114 138  82
3   92  77  0   2 89  24  62  59  97  52
4  134   6  2   0 71  23  43  80  35  86
5   42  99 89  71  0  68  95  27  55  14
7  123  46 24  23 68   0 124  18  53 101
8   40  47 62  43 95 124   0 126  11 129
10 107 114 59  80 27  18 126   0  31  13
11  49 138 97  35 55  53  11  31   0  75
12  93  82 52  86 14 101 129  13  75   0

I believe this can be transformed to cycle in which you need to test 
whether there is any NA for ending a cycle or not starting it if there is 
no NA values.

Regards
Petr
or
6.
in
statement of it.
wrote:
row 6 and
http://www.R-project.org/posting-guide.html
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-
http://www.R-project.org/posting-guide.html
http://www.R-project.org/posting-guide.html