Skip to contents

counts the occurrences of reactions/indications/substance for a given set of primary IDs. Calculates % as the proportion of individuals recording the event.

Usage

reporting_rates(
  pids_cases,
  entity = "reaction",
  level = "pt",
  drug_role = c("PS", "SS", "I", "C"),
  drug_indi = NA,
  temp_reac = Reac,
  temp_drug = Drug,
  temp_indi = Indi
)

Arguments

pids_cases

Vector of primary IDs to consider for counting reactions.

entity

Entity investigated. It can be one of the following:

  • reaction;

  • indication;

  • substance.

level

The desired MedDRA or ATC level for counting (default is "pt").

drug_role

is only used for substances. By default both suspect and concomitant drugs are included.

drug_indi

is only used for indications. By default the indications of all the drugs of the selected primaryids are considered, but you can specify a vector of drugs.

temp_reac

Reac dataset. Can be set to sample_Reac for testing

temp_drug

Drug dataset. Can be set to sample_Drug for testing

temp_indi

Indi dataset. Can be set to sample_Indi for testing

Value

A data.table containing counts and percentages of the investigated entity at the specified level and in descending order.

Examples

# select only reports recording paracetamol from the sample dataset,
# and provide the most reported events (at the pt level),
# drugs, and indications (at the PT level).
pids_cases <-
reporting_rates(unique(sample_Drug[substance == "paracetamol"]$primaryid),
 "reaction", "pt",
  temp_reac = sample_Reac,
  temp_drug = sample_Drug, temp_indi = sample_Indi
)
reporting_rates(unique(sample_Drug[substance == "paracetamol"]$primaryid),
  "indication", "pt",
  temp_reac = sample_Reac,
  temp_drug = sample_Drug, temp_indi = sample_Indi
)
#>                                   pt
#>                                <ord>
#>   1:            rheumatoid arthritis
#>   2:             plasma cell myeloma
#>   3:              multiple sclerosis
#>   4:                       psoriasis
#>   5:                    hypertension
#>  ---                                
#> 378:                   endometriosis
#> 379:                 fabry's disease
#> 380:        ovarian cancer recurrent
#> 381: pancreatic carcinoma metastatic
#> 382:          antibiotic prophylaxis
#>                                         label_pt  N_pt
#>                                           <char> <int>
#>   1:           rheumatoid arthritis (7.58%) [55]    55
#>   2:            plasma cell myeloma (3.99%) [29]    29
#>   3:             multiple sclerosis (3.44%) [25]    25
#>   4:                      psoriasis (3.44%) [25]    25
#>   5:                   hypertension (3.03%) [22]    22
#>  ---                                                  
#> 378:                   endometriosis (0.14%) [1]     1
#> 379:                 fabry's disease (0.14%) [1]     1
#> 380:        ovarian cancer recurrent (0.14%) [1]     1
#> 381: pancreatic carcinoma metastatic (0.14%) [1]     1
#> 382:          antibiotic prophylaxis (0.14%) [1]     1
reporting_rates(unique(sample_Drug[substance == "paracetamol"]$primaryid),
  entity = "substance",
  temp_reac = sample_Reac, temp_drug = sample_Drug,
  temp_indi = sample_Indi
)
#>                 substance                  label_substance N_substance
#>                    <fctr>                           <char>       <int>
#>   1:          paracetamol          paracetamol (5.1%) [51]          51
#>   2: acetylsalicylic acid acetylsalicylic acid (4.9%) [49]          49
#>   3:           adalimumab           adalimumab (4.5%) [45]          45
#>   4:                 <NA>                   NA (3.8%) [38]          38
#>   5:           etanercept           etanercept (3.8%) [38]          38
#>  ---                                                                  
#> 717:                water                 water (0.1%) [1]           1
#> 718:            entecavir             entecavir (0.1%) [1]           1
#> 719:        canagliflozin         canagliflozin (0.1%) [1]           1
#> 720:           ofatumumab            ofatumumab (0.1%) [1]           1
#> 721:             cefepime              cefepime (0.1%) [1]           1