fix_database_error: Function to make database fixes after import

View source: R/fix_database_error.R

fix_database_errorR Documentation

Function to make database fixes after import

Description

Use this function to make updates to your data while avoiding adding PHI, such as MRNs, to your code and subsequently PHI in GitHub. You provide a file of database fixes that is three columns: 1. An expression that selects a line in the database to update (e.g. MRN == "12345678"), 2. The column name that will be updated, and 3. The updated value. See the examples for the structure of the database fix input.

Usage

fix_database_error(data, engine = readr::read_csv, ...)

Arguments

data

data frame with errors

engine

function to import file of database fixes

...

arguments passed to the engine function to import the database fixes

Value

updated data frame

Examples

df_fixes <-
  tibble::tribble(
    ~id, ~variable, ~value,
    "id == 1", "age", "56",
    "id == 2", "trt", "Drug C"
  )
trial %>%
  dplyr::mutate(id = dplyr::row_number()) %>%
  fix_database_error(
    engine = I,
    x = df_fixes
  )

ddsjoberg/bstfun documentation built on July 4, 2023, 10:59 a.m.