OHDSI Home | Forums | Wiki | Github

Problems in Covariates when it comes to run CohortMethod()

Hello. I ask some question of covariates.

I’m struggling with using CohortMethod pacakges in R and when I run getDbCohortMethodData() function, foutunately it runs.

But the point is the result of that function show that it has no covariates like below.

Number of covariates: NA
Number of non-zero covariate values: NA

Before I run getDbCohortMethodData(), I set covariates with run createDefaultCovariateSettings() and when I check the concept ID of covariates that I will exclude it shows it.

I don’t know what is the problems and how to solve this one. Please help me :slight_smile:

How many people are in the target and comparator cohorts (see summary(cohortMethodData))? Do you require the cohorts to have prior observation time?

@schuemie There are 34309 people in target cohorts and 38036 people in comparator cohorts.

I also run this code to set covariates

cs ← createCovariateSettings(useDemographicsGender = TRUE,
useDemographicsAgeGroup = TRUE,
useConditionOccurrenceAnyTimePrior = TRUE,
excludedCovariateConceptIds = c(#covariates#),
addDescendantsToExclude = TRUE)


Hmmm, confusing indeed! Any messages that pop up when running getDbCohortMethodData()? Could you turn on a logger (e.g. using addDefaultFileLogger()) to capture the log before running getDbCohortMethodData()?

@schuemie When I run getDbCohortMethodData(), there’s a warining meassages below.

Warning: Removing drugs from covariates, but not sure if exposure IDs are valid drug concepts
Warning: This function is deprecated. Use ‘render’ instead.
Warning: This function is deprecated. Use ‘translate’ instead.

And there’s a message below too…

I don’t know why the total count of covariates is NA… :frowning:

These message too!

“can only read in bytes in a non-UTF-8 MBCS locale”


That ‘non-UTF-8’ message was also reported here, and seems to be related to the character set being used. Could you provide a bit more context around that message, so I know what is throwing it?

It is weird that the number of covariates is reported to be NA, not 0. Could you see if there are any covariates?:


Thank you for your kindly reply @schuemie .

It shows below.


Seems like they have covariates but slightly not correct…

I don’t know if this helps, but would you mind trying the develop version of DatabaseConnector? This can be installed using

remotes::install_github("ohdsi/DatabaseConnector", ref = "develop")

Then try to run getDbCohortMethodData() again.

Okay I will run that code and let you know the progressing.

Thank you @schuemie !! :smile:

@schuemie , Seems like it has problems… when I run this code

remotes::install_github(“ohdsi/DatabaseConnector”, ref = “develop”)

, it shows below.

package ‘CohortMethod’ is in use and will not be installed

@schuemie Fortunately, when I run this code below,


Everything has done well!!

I do not understand why the problem has solved but one thing that I knew is the version of CohortMethod package is 4.2.1.

By the way, I’m really appreciate your efforts! Thank you very much :slight_smile: