cran / MendelianRandomization

:exclamation: This is a read-only mirror of the CRAN R package repository. MendelianRandomization — Mendelian Randomization Package
44 stars 28 forks source link

Error #6

Open kitscorp opened 7 months ago

kitscorp commented 7 months ago

First of all, thank you for providing this package. I hope this is the right place to ask this.

I'm running into an error when using the mr_forest function with the "conmix" method: Error in levels<-(*tmp*, value = as.character(levels)) : factor level [2] is duplicated

Several of my data inputs ran fine, but one input dataframe throws this error for the conmix method specifically (although I can't see anything obviously wrong with the data). A reproducible example is included below:

outcome<-"outcome"
exposure<-"exposure"
data <- data.frame(SNP = c("rs1", "rs2", "rs3", "rs4", "rs5","rs6","rs7", "rs8", "rs9"),
beta_exposure = c(-0.615, 0.092, -0.066, 0.065, 0.065,
                      0.059, 0.872, 0.063, -0.048),
se_exposure = c(0.020, 0.007, 0.007, 0.006, 0.007,
                    0.007, 0.116, 0.009, 0.007),
beta_outcome = c(-0.01260620, -0.00186184, 0.00275511, 0.00632551, 0.01032940,
                     -0.01004970, 0.02024740, 0.00547238, -0.01407590),
se_outcome = c(0.00965377, 0.00337398, 0.00316966, 0.00310217, 0.00329157,
                   0.00307773, 0.05899670, 0.00435493, 0.00342480))

MRInputObject <- mr_input(bx = data$beta_exposure,bxse = data$se_exposure,by = data$beta_outcome,byse = data$se_outcome,exposure=exposure,outcome=outcome,snps=data$SNP)

mr_forest(MRInputObject,snp_estimates=FALSE,methods=c("conmix"))

Any insights would be appreciated!

gaborcsardi commented 7 months ago

Hi, this is a read only mirror of CRAN, please see the package authors in the DESCRIPTION file. Look for Maintainer, BugReports and URL. Thanks!