unlink("tmp*")
a <- matrix(rnorm(50),10,5)
rownames(a) <- paste("id",1:10,sep="")
colnames(a) <- paste("snp",1:5,sep="")
b <- as(a,"databel")
apply(a,FUN="sum",MAR=2)
apply2dfo(SNP,dfodata=b,anFUN="sum")
tA <- apply2dfo(SNP,dfodata=b,anFUN="sum",outclass="databel",outfile="tmpA")
tA
as(tA,"matrix")
apply2dfo(SNP,dfodata=b,anFUN="sum",transpose=FALSE)
tB <- apply2dfo(SNP,dfodata=b,anFUN="sum",transpose=FALSE,outclass="databel",outfile="tmpB")
tB
as(tB,"matrix")
sex <- 1*(runif(10)>.5)
trait <- rnorm(10)+sex+as(b[,2],"vector")+as(b[,2],"vector")*sex*5
apply2dfo(trait~SNP*sex,dfodata=b,anFUN="lm")
tC <- apply2dfo(trait~SNP*sex,dfodata=b,anFUN="lm",outclass="databel",outfile="tmpC")
tC
as(tC,"matrix")
apply2dfo(trait~SNP*sex,dfodata=b,anFUN="lm",transpose=FALSE)
tD <- apply2dfo(trait~SNP*sex,dfodata=b,anFUN="lm",transpose=FALSE,outclass="databel",outfile="tmpD")
tD
as(tD,"matrix")
rm(tA,tB,tC,tD)
gc()
unlink("tmp*")Run the code above in your browser using DataLab