if(same.dim==TRUE&!all(is.null(same.row.pos1),is.null(same.row.pos2),is.null(same.col.pos1),is.null(same.col.pos2))){# same.dim == TRUE means that same.row.nb == TRUE and same.col.nb == TRUE, meaning that row.nb != NULL and col.nb != NULL. Thus, no need to include these checkings