OHDSI Home | Forums | Wiki | Github

Error in CohortMethod()

Hi! I ask some question about CohortMethod().

execute(connectionDetails = connectionDetails,
cdmDatabaseSchema = cdmDatabaseSchema,
cohortDatabaseSchema = cohortDatabaseSchema,
cohortTable = cohortTable,
oracleTempSchema = oracleTempSchema,
outputFolder = outputFolder,
databaseId = databaseId,
databaseName = databaseName,
databaseDescription = databaseDescription,
createCohorts = TRUE,
synthesizePositiveControls = TRUE,
runAnalyses = TRUE,
runDiagnostics = TRUE,
packageResults = TRUE,
maxCores = 1)

When I run this code above, I’ve got this error below.

Summarizing results
|====================================================================================================================================| 100%
Computing covariate balance
Error in if (!file.exists(file)) stop("Cannot find file ", file) :
argument is of length zero
In addition: Warning message:
Unknown or uninitialised column: cohortMethodDataFolder.
Warning message:
In ParallelLogger::unregisterLogger(“DEFAULT”) :
Could not find logger DEFAULT

What should I do ? Thanks!

And also when set maxCore = parallel::detectCores(), I’ve got error below too…

Error in ParallelLogger::clusterApply(cluster, subset, computeCovariateBalance, :
Error(s) when calling function ‘fun’, see earlier messages for details

Still doesn’t working… @schuemie , @SCYou any suggestions on this error?

Could you check how many subject are included in target, comparator, and outcome cohorts?

According to the CohortCounts.csv, there are around 30,000 subjects include targer, comparator and outcome cohorts.

And also there are few warnings below (Set maxCores=1) after I install latest version of ParellelLogger.

Summarizing results
|====================================================================================================================================| 100%
Computing covariate balance
Error in if (!file.exists(file)) stop("Cannot find file ", file) :
argument is of length zero
In addition: Warning message:
Unknown or uninitialised column: cohortMethodDataFolder.
Warning message:
In ParallelLogger::unregisterLogger(“DEFAULT”) :
Could not find logger DEFAULT

When I run this code, the error always occured when it computing covariate balance…Seems like there are problem or probably the study design have problem but i don’t really think so…quite hard…

My best guess is there are incompatibility issues between packages. Which study package are you running? Which version of CohortMethod?

I highly recommend using the latest skeleton, which can be hydrated using the latest Hydra, as described here. This skeleton uses renv to make sure all correct versions are installed.

The study packages generated by ATLAS use skeletons and Hydra from several years ago. I don’t know why they’re not updating ATLAS.

I use PLE study package generated by ATLAS. I used 4.2.1 version of CohortMethod. All results above is the result of 4.0.5 version of R and now I’m trying to upgrade latest version of R . Thank you @schuemie ! I’ll let you know the progressing!

Hmm do you know why I have an error when I run this code?

download.file(“https://raw.githubusercontent.com/ohdsi-studies/StudyPackage1/main/renv.lock”, “renv.lock”)

It said it can’t be opened…

Assumes you’ve already uploaded your study package to ohdsi-studies. Try running renv::init() to start using the lock file locally (if there’s a file called ‘renv.lock’ in your folder)

Seems like that code doesn’t work well. If I run those code, error occurs below

cannot open URL ‘https://raw.githubusercontent.com/ohdsi-studies/StudyPackage1/main/renv.lock’: HTTP status was ‘404 Not Found’

I’m confused. Are you saying

renv::init()

causes that error message?

Do you have your study package on GitHub somewhere for me to look at?

I think I’m still confusing of using HADES :frowning: I should read guideline more…

That’s ok. We haven’t yet documented this stuff very well. I recommend reading this to understand more about renv.

Thank you for taking your time @schuemie :slight_smile:

I’m still struggling with this but when I run execute() code, an error has occurred below.

verifyDependencies() has an error
Mismatch between required and installed package versions. Did you forget to run renv::restore()?

  • Package rlang version 1.0.4 should be 1.0.1
  • Package glue version 1.6.2 should be 1.6.1
  • Package cli version 3.3.0 should be 3.1.1
  • Package crayon version 1.5.1 should be 1.4.2
  • Package fansi version 1.0.3 should be 1.0.2
  • Package magrittr version 2.0.3 should be 2.0.2
  • Package vctrs version 0.4.1 should be 0.3.8
  • Package pillar version 1.8.0 should be 1.6.5
  • Package colorspace version 2.0.3 should be 2.0.2
  • Package generics version 0.1.3 should be 0.1.2
  • Package Rcpp version 1.0.9 should be 1.0.8
  • Package tibble version 3.1.7 should be 3.1.6
  • Package tidyselect version 1.1.2 should be 1.1.1
  • Package tzdb version 0.3.0 should be 0.2.0
  • Package withr version 2.5.0 should be 2.4.3
  • Package blob version 1.2.3 should be 1.2.2
  • Package clipr version 0.8.0 should be 0.7.1
  • Package DBI version 1.1.3 should be 1.1.2
  • Package dplyr version 1.0.9 should be 1.

So I run renv::restore(), but I have an another error below.

ERROR: compilation failed for package ‘CohortMethod’

  • removing ‘C:/***/renv/staging/1/CohortMethod’
    ERROR: install of package ‘CohortMethod’ failed [error code 1]

So, I changed the option like this verifyDependencies = FALSE, and run execute().

Unfortunately, other error has occurred…

*** Fitting outcome models for other outcomes ***
Removing subjects with prior outcomes (if any)
Removing subjects with less than 1 day(s) at risk (if any)
Using prior: None

Warning: BLR gradient is ill-conditioned
Enforcing convergence!
Using prior: None

Warning: BLR gradient is ill-conditioned
Enforcing convergence!
Using 1 thread(s)
Using 1 thread(s)
An error report has been created at C:***/errorReportR.txt
Error occurred in coef.cyclopsFit(fit) :
Cyclops estimation is null; suspect that estimation did not converge.

Is there a problem in CohortMethod() which the version of it is 4.2.2.? Or another problem that I miss?

Thank you.

verifyDependencies should definitely be set to TRUE. That is the only way to be sure you’re running the right versions of all the packages.

I’m not aware of R 4.2.2 (it hasn’t been released yet), but it should run fine on R 4.2.1.

Did you update RTools to version 42? Rtools42 for Windows

Oh mine was RTools40…

4.2.2 is the version of CohortMethod()

I’ll let you know after I update Rtool42!!

Ah, sorry for the misunderstanding. Depending on which version of R you’re running you should run specific versions of RTools. You should only use RTools 42 if you’re running R 4.2.

t