Displaying 1 result from an estimated 1 matches for "st208".
Did you mean:
t208
2012 May 31
0
ignore NA column in a DF (for calculation) without removing them
...a list.files.
Here's the function:
get.max.cor <- function(station, mat){
mat[row(mat) == col(mat)] <- -Inf
which( mat[station, ] == max(mat[station, ],na.rm=TRUE) )
}
If I have a correlation matrix like this (no NA-value):
cor1 <- read.table(text="
ST208 ST209 ST210 ST211 ST212
ST208 1.0000000 0.8646358 0.8104837 0.8899451 0.7486417
ST209 0.8646358 1.0000000 0.9335584 0.8392696 0.8676857
ST210 0.8104837 0.9335584 1.0000000 0.8304132 0.9141465
ST211 0.8899451 0.8392696 0.8304132 1.0000000 0.8064669
ST212 0.7486417 0.8676857 0.9141465...