data(sampson)
samplike[1,2] <- NA
samplike[4.1] <- NA
sm <- as.matrix(samplike)
tst <- function(x,y){
mapply(identical, x, y)
}
stopifnot(all(tst(as.logical(as.matrix(ergm_symmetrize(samplike, "weak"))), sm | t(sm))),
all(tst(as.logical(as.matrix(ergm_symmetrize(samplike, "strong"))), sm & t(sm))),
all(tst(c(as.matrix(ergm_symmetrize(samplike, "upper"))),
sm[cbind(c(pmin(row(sm),col(sm))),c(pmax(row(sm),col(sm))))])),
all(tst(c(as.matrix(ergm_symmetrize(samplike, "lower"))),
sm[cbind(c(pmax(row(sm),col(sm))),c(pmin(row(sm),col(sm))))])))
Run the code above in your browser using DataLab