Skip to contents

Reading/Writing File Functions

File Reading Functions

read_hashed_file()
Reads a file if the supplied hash matches the file's hash
read_csv_with_hash()
Reads data from csv file and prints hash of contents.
read_file_with_hash()
Reads the data from a file (csv or parquet) and prints the hash
read_parquet_with_hash()
Reads data from parquet file and prints hash of contents.
read_pzfx_with_hash()
Reads in table from a prism pzfx file.
read_sas_with_hash()
Reads data from sas file and prints hash of contents.
read_xpt_with_hash()
Reads data from xpt file and prints hash of contents.
read_excel_with_hash()
Reads data from xlsx/xls file and prints hash of contents.

File Writing Functions

write_csv_with_hash()
Writes data to csv_path with na_value replacing NA values.
write_file_with_hash()
Writes data to path, if directory doesn't exist it is created before file is written
write_parquet_with_hash()
Writes data to parquet_path and prints hash

Data Manipulation

Demographic Manipulations

is_white()
Takes character input and returns TRUE/FALSE if white/other
is_black()
Takes character input and returns TRUE/FALSE if black/other also checks for "African American" and "Black or African American"
is_asian()
Takes character input and returns TRUE/FALSE if asian/other
is_other()
Takes character input and returns TRUE/FALSE if other/explicit race
racen()
Takes character input and returns standard yspec numeric value for Race
is_hispanic_or_latino()
Takes character input and returns TRUE/FALSE if "Hispanic or Latino" or other
is_not_hispanic_or_latino()
Takes character input and returns TRUE/FALSE if "Not Hispanic or Latino" or other
ethnicn()
Takes character input and returns standard yspec numeric value for Ethnic
sexf()
Takes character input and returns standard yspec numeric value for Sex.
is_female()
Takes character input and returns TRUE/FALSE if female/male

Vitals Functions

bbmi()
Calculates Baseline Body Mass Index based on Weight and Height
bsa()
Calculates Body Surface Area based on Weight and Height using the method specified. Default is Dubois.
dubois_bsa()
Calculates Body Surface Area based on Weight and Height using Dubois Dubois equation
mosteller_bsa()
Calculates Body Surface Area based on Weight and Height using Mosteller equation
crcl()
Calculates Creatinine clearance with Cockcroft-Gault equation
brfc()
Calculates renal impairment categories based on CrCL
bhfc()
Calculates hepatic function criteria
egfr()
Calculates eGFR based on the method specified
ckdepi_2009_egfr()
Calculates Estimated Glomerular Filtration Rate based on Sex, Race, Age, and Creatinine levels based on the CKDEPI 2009 equation
ckdepi_2021_egfr()
Calculates eGFR using the CKDEPI 2021 creatinine equation
ckdepi_2021_egfr_cystatin()
Calculates eGFR with CKDEPI 2021 cystatin equation
mdrd_egfr()
Modification of Diet in Renal Disease eGFR calculation
schwartz_egfr()
Calculates eGFR based on Schwartz' equation

Statistical Functions

cv()
Computes the coefficient of variation of input vector.
geom_cv()
Computes the geometric CV of a vector x
geom_mean()
Computes the geometric mean of a vector.
geom_sd()
Computes the geometric standard deviation of a vector x.
categorize()
Converts continuous variable into factor categories.

Unit Checks

check_for_unique_units()
Gives a TRUE/FALSE for if the Parameters have only 1 associated unit
get_unique_units_df()
Creates a dataframe with distinct parameters and units combinations
create_dir()
Creates the directory if it doesn't exist