[R] problems while correlating values

Christian Ritz ritz at bioassay.dk
Sun May 28 23:13:22 CEST 2006


Hi.

Try compute the correlation for the transposed data frame:

    cor( t(person.data), use="pairwise.complete.obs" )


Assuming that your data frame "person.data" contains NAs to indicate 
where no value is available, I think the following computation yields N:

    (!is.na(person.data)) %*% t(!is.na(person.data))

using the functions "is.na", "!" (negation), "%*%" (matrix 
multiplication) and "t" (matrix transpose). For details see their help 
pages.

Christian



More information about the R-help mailing list