R/mat_d.R

Defines functions mat_d

mat_d <-
function(mat){
    for(i in seq_len(dim(mat)[1])){
        s <- grep(1,mat[i, ])
        for(j in s){
            if(j == i) mat <- mat
            else{
                w <- grep(1, mat[j,])
                mat[i, w] <- rep(1, length(w))
                mat[j, ] <- rep(0, dim(mat)[1])
            }
        }
    }
    return(mat)}

Try the TTMap package in your browser

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

TTMap documentation built on Nov. 8, 2020, 7:30 p.m.