gertvv / gemtc

GeMTC R package: model generation for network meta-analysis
GNU General Public License v3.0
43 stars 25 forks source link

Issue with covariateplot #63

Closed DanielReid closed 3 years ago

DanielReid commented 3 years ago

To replicate:

 library(RJSONIO)
    library(gemtc)
    source('gemtc.R') # from https://raw.githubusercontent.com/drugis/gemtc-web/develop/R/gemtc.R
    update <- print
    params <- fromJSON(file('parkinson-rel.json'))
    results <- gemtc(params)

Error:

 Error in Ops.factor(stats[["t1"]], pair[1]) : 
  level sets of factors are different

traceback()

12: stop("level sets of factors are different")
11: Ops.factor(stats[["t1"]], pair[1])
10: [.data.frame(stats, stats[["t1"]] == pair[1] & stats[["t2"]] == 
        pair[2], c("median", "lower", "upper"))
9: stats[stats[["t1"]] == pair[1] & stats[["t2"]] == pair[2], c("median", 
       "lower", "upper")]
8: FUN(X[[i]], ...)
7: lapply(X = X, FUN = FUN, ...)
6: sapply(res, function(stats) {
       stats[stats[["t1"]] == pair[1] & stats[["t2"]] == pair[2], 
           c("median", "lower", "upper")]
   })
5: plotCovariateEffect(result, t1, t2) at gemtc.R#586
4: plotFunction() at gemtc.R#205
3: plotToFile(plotFunction, "image/png", ".png", png) at gemtc.R#227
2: plotToPng(function() {
       plotCovariateEffect(result, t1, t2)
   }) at gemtc.R#585
1: gemtc(params)

parkinson-rel.zip

gertvv commented 3 years ago

The example works for me (R-devel of 2020-11-27 r79522) - both using gemtc master and gemtc 1.0-0 from CRAN. What versions of R and gemtc are you using?

filea70ea2f571803-00001

kzalite commented 3 years ago

We are running R version 3.4.4 (2018-03-15) and gemtc 1.0-0. We will try to update R.

DanielReid commented 3 years ago

So a lot of version-wrangling later we've now got a running worker again. Sorry for the bother.

gertvv commented 3 years ago

So it doesn't work with R 3.4? I don't have access to that but I can test on 3.6 - I might still want to fix or bump the minimum R version. Lots of people using the version that comes with their distro.

gertvv commented 3 years ago

Yes, it also breaks on 3.6.

DanielReid commented 3 years ago

OK, so we did unearth a more general issue, good to know. We have some old docker containers with R 3.4 if you want to play with those ;)

https://hub.docker.com/layers/addis/patavi-gemtc-worker/latest/images/sha256-d0388f729b511be7db8336d270b8aef2180d50eee31718bd2b4a165e542631e2?context=repo

gertvv commented 3 years ago

Fix is on master, I may include some other fixes before submitting to CRAN as this seems fairly low urgency.