Learn R Programming

qualitycontrol (version 0.1.0)

test_range: Test the range of a variable on a dataset

Description

Test the range of a variable on a dataset

Usage

test_range(
  data,
  variable,
  type,
  categories = NULL,
  lower_value = NULL,
  upper_value = NULL
)

Value

A data frame containing all the findings regarding the applied test.

Arguments

data

data to be tested.

variable

The variable to be tested.

type

String such as 'categorical', 'date' or 'numeric'

categories

Only to be filled if type is 'categorical'. String of categories.

lower_value

Only to be filled if type is 'numeric' or 'date'. Can be numeric or string.

upper_value

Only to be filled if type is 'numeric' or 'date'. Can be numeric or string.

Examples

Run this code
test_range(als_data, 'onset', c('bulbar','respiratory', 'spinal'), type = 'categorical')
test_range(als_data, 'age_at_baseline', lower_value = 20, upper_value = 100, 
type = 'numeric')
test_range(als_data, 'age_at_onset', lower_value = 20, upper_value = 100,
type = 'numeric')
test_range(als_data, 'baseline_date', lower_value = '2000-01-01', upper_value = '2022-01-01', 
type = 'date')
test_range(als_data, 'death_date', lower_value = '2000-01-01', upper_value = '2022-01-01',
 type = 'date')

Run the code above in your browser using DataLab