This function performs a row-wise binding of multiple SnpMatrix objects,
explicitly preserving row names and column names, avoiding unexpected "object has no names" warnings.
rbind_SnpMatrix(...)A single combined SnpMatrix with preserved row and column names.
m1 <- methods::new("SnpMatrix",
matrix(as.raw(1:3), nrow = 2, ncol = 3,
dimnames = list(c("S1", "S2"),
c("SNP1", "SNP2", "SNP3"))))
m2 <- methods::new("SnpMatrix",
matrix(as.raw(1:3), nrow = 2, ncol = 3,
dimnames = list(c("S3", "S4"),
c("SNP1", "SNP2", "SNP3"))))
rbind_SnpMatrix(m1, m2)
#> Performing safe rbind on SnpMatrix objects...
#> Row and column names preserved after rbind.
#> SNP1 SNP2 SNP3
#> S1 01 03 02
#> S2 02 01 03
#> S3 01 03 02
#> S4 02 01 03