[R] number of pairwise present data in matrix with missings

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.ac.be
Tue Nov 23 16:06:05 CET 2004


Sorry my first reply was not relevant, I understood a different thing.

Dimitris

----- Original Message ----- 
From: "Andreas Wolf" <andreas.wolf at uni-jena.de>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, November 23, 2004 2:42 PM
Subject: [R] number of pairwise present data in matrix with missings


> is there a smart way of determining the number of pairwise present 
> data
> in a data matrix with missings (maybe as a by-product of some
> statistical function?)
>
> so far, i used several loops like:
>
> for (column1 in 1:99) {
>  for (column2 in 2:100) {
>    for (row in 1:500) {
>      if (!is.na(matrix[row,column1]) & !is.na(matrix[row,column2])) 
> {
>        pairs[col1,col2] <- pairs[col1,col2]+1
>      }
>    }
>  }
> }
>
> but this seems neither the most elegant nor an utterly fast 
> solution.
>
> thanks for suggestions.
> andreas wolf
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list