[R] matching doesn't work

Rasmus Liland jen@r@@mu@ @end|ng |rom gm@||@com
Sat Apr 11 16:51:22 CEST 2020


On 2020-04-10 19:05 -0500, Ana Marija wrote:
> I am not sure what I am suppose to run 
> from your codes.  Can you just send me 
> lines of codes which I should run? 
> (without part where you are loading 
> your data frames) (assuming my files 
> are as I showed them)

Dear Ana,

try these lines:


plink.genome <-
  read.table("plink.genome", header=TRUE)
SNPRelate::snpgdsBED2GDS(
  "output4.bed",
  "output4.fam",
  "output4.bim",
  "HapMap.gds")
genofile <-
  SNPRelate::snpgdsOpen("HapMap.gds")
ibd <- SNPRelate::snpgdsIBDMoM(
  genofile,
  remove.monosnp=FALSE,
  kinship=TRUE)
x <- paste(plink.genome$IID1,
           plink.genome$IID2)
table <- paste(ibd$ID1, ibd$ID2)
idx <- match(x=x, table=table)
plink.genome[idx,]


Best,
Rasmus



More information about the R-help mailing list