R/nmlz.R

## nmlz: Returns the normalization matrix "J" of columns of M. That is: M %*% J has unit length columns. Zero columns correspond to "1" (unchanged).
nmlz = function(M){
    J = diag(1/apply(M,2,l2))
    diag(J)[which(diag(J) == Inf)] = 1
    return(J)
}

Try the rNMF package in your browser

Any scripts or data that you put into this service are public.

rNMF documentation built on May 2, 2019, 12:22 p.m.