Learn R Programming

admiralonco (version 1.4.0)

get_crpr_dataset: Get CR Records Followed by PR That Lead to a Prior Error

Description

Get CR Records Followed by PR That Lead to a Prior Error

Usage

get_crpr_dataset()

Arguments

Value

A data.frame or NULL

Author

Stefan Bundfuss

Details

Some {admiralonco} functions check that in the source records CR is not followed by PR and throw an error otherwise. The get_crpr_dataset() function allows one to retrieve the duplicate records that lead to an error.

Note that the function always returns the dataset of duplicates from the last error that has been thrown in the current R session. Thus, after restarting the R sessions get_crpr_dataset() will return NULL and after a second error has been thrown, the dataset of the first error can no longer be accessed (unless it has been saved in a variable).

See Also

signal_crpr()

Utilities for Dataset Checking: signal_crpr()

Examples

Run this code
library(tibble)
library(dplyr)
library(lubridate)
library(admiralonco)
library(rlang)

adrs <- tribble(
  ~USUBJID, ~ADTC,        ~AVALC,
  "1",      "2020-01-01", "PR",
  "1",      "2020-02-01", "CR",
  "1",      "2020-02-16", "NE",
  "1",      "2020-03-01", "CR",
  "2",      "2020-02-06", "PR",
  "2",      "2020-02-16", "CR",
  "2",      "2020-03-30", "PR",
) %>%
  mutate(
    ADT = ymd(ADTC),
    STUDYID = "XX1234"
  )

signal_crpr(adrs, order = exprs(ADT))

get_crpr_dataset()

Run the code above in your browser using DataLab