R/insertMatBtoA.R

Defines functions insertMatBtoA

insertMatBtoA <- function(A, B) {
    namesA <- rownames(A)
    namesB <- rownames(B)
    namesAinB <- namesA[namesA %in% namesB]
    namesA2 <- colnames(A)
    namesB2 <- colnames(B)
    namesAinB2 <- namesA2[namesA2 %in% namesB2]
    A[namesA %in% namesB, namesA2 %in% namesB2] <- B[match(namesAinB, 
        namesB), match(namesAinB2, namesB2)]
    return(A)
    
}

Try the CovCombR package in your browser

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

CovCombR documentation built on March 26, 2020, 7:15 p.m.