Skip to content

error when argument countBy = "person" only for summariseCodeUse #255

Description

@daniellenewby

Describe the bug
When using the argument summariseCodeUse and setting countBy = "person" an error message occurs.

To Reproduce
Steps to reproduce the behavior:

atc2 <- c("ANTIEMETICS AND ANTINAUSEANTS" ,
          "DRUGS FOR FUNCTIONAL GASTROINTESTINAL DISORDERS"  )

atc2_codelist <- getATCCodes(
  cdm,
  level = c("ATC 2nd"),
  name = atc2,
  doseForm = NULL,
  doseUnit = NULL,
  routeCategory = NULL,
  type = "codelist"
)

atc2_codelist_n <- summariseCodeUse(atc2_codelist, 
                                    countBy = "person",
                                    byConcept = FALSE,
                                    cdm = cdm)
error message:
Error in `dplyr::mutate()` at CodelistGenerator/R/summariseCodeUse.R:417:5:
ℹ In argument: `variable_name = dplyr::if_else(...)`.
Caused by error in `.data$standard_concept_name`:
! Column `standard_concept_name` not found in `.data`.
Run `rlang::last_trace()` to see where the error occurred.

Expected behavior

A clear and concise description of what you expected to happen.
Should return code use for person counts only but an error message occurs. For now just setting to default where it returns both record and person counts.

Screenshots
NA

Desktop (please complete the following information):

  • Browser chrome
  • Version Cran version codelistgenerator as of todays date (26/6/26)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions