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