I am dealing with a new R object class for me, a BEDMatrix object. I have created a BEDMatrix from the standard plink files. Now I want to merge it with a regular matrix object in R. I have tried the functions merge() and join(), but all of them seem not to support the BEDMatrix object. Here is the code:
#----------------------- creating BEDMatrix--------------------------------------
library(BGData)
chr29 <- BEDMatrix("path to plink file")
#--------------------------------reading excel file---------------------------------------
library(readxl)
sheets <- excel_sheets(path = 'path to excel file')
Excel_rawTAUINDanimalList <- read_excel(path = 'path to excel file', sheet = "rawTAUIND-animalList")
# -------------- changing excel file to matrx ----------------------------------------------
excel_matrix <- as.matrix(Excel_rawTAUINDanimalList)
# ------------------------ trying to merge ------------------------------------------------
merged <- merge(chr29, excel_matrix, by.x = 1, by.y = 1, all.x = TRUE, all.y = TRUE)
I get this error:
can't covert ‘structure("BEDMatrix", package = "BEDMatrix")’ to data.frame
Any help would be appreciated.
Thanks,
Qba Liu