scicalc 0.4.0
New features
- Categorical mapping functions are now configurable through options:
-
racen()recognizes six race categories (white, black, asian, american native, pacific islander, other/multiple). Setoptions(scicalc.racen_config = )to a named numeric vector to override any category’s code and to add novel categories (matched before the built-ins). -
agec()andbmic()accept fully custom bands viaoptions(scicalc.agec_config = )/options(scicalc.bmic_config = )— a data frame withlabel,min(lower bound), andcodecolumns that replaces the FDA/WHO defaults. Bands are half-open[min, next min)with an open-ended top band. - Any active configuration is listed in the package startup message.
-
- Added
is_missing_value(), a predicate for the missing-value sentinel (getOption("scicalc.missing_value"), default-999), e.g.dplyr::filter(df, !is_missing_value(x)). - Calculation functions now handle the missing-value sentinel in their inputs: a sentinel value is treated as missing during the computation and the sentinel is preserved in the result.
-
read_file_with_hash()andread_hashed_file()gained areaderargument for file types they don’t natively support (e.g.reader = arrow::read_feather);write_file_with_hash()gained a matchingwriterargument. For a known extension the custom function is ignored unlessforce = TRUE.
Bug fixes
-
egfr(): passmethodby name; positional args aresexf, raceb, age, creat, cystc, height. Passing a method string positionally now errors instead of silently defaulting. -
rfc()now honors an explicitly-suppliedabsolute_units; the estimator’sscicalc_unitsattribute is used only as a fallback whenabsolute_unitsis not given. -
write_csv_with_hash()andwrite_parquet_with_hash()were filtering...against the wrong function’s arguments (read_csv()/read_parquet()instead ofwrite_csv()/write_parquet()), silently dropping valid writer arguments likeeolorcompression.
Changes
The unit-tracking attribute is now
scicalc_unitsrather than a genericunitsattribute. Computed quantities still carry it (egfr()/aegfr()as"mL/min/1.73m^2"/"mL/min",bmi()"kg/m^2",bsa()"m^2",ibw()/aibw()"kg",crcl()"mL/min",convert_alb/bili/creat()"g/dL"/"mg/dL"), andrfc()reads it to infer relative-vs-absolute whenabsolute_unitsis not supplied. ## DeprecationsThe individual eGFR equation functions (
ckdepi_2009_egfr(),ckdepi_2021_egfr(),ckdepi_2021_egfr_cystatin(),mdrd_egfr(),schwartz_egfr()) and BSA equation functions (dubois_bsa(),mosteller_bsa()) are deprecated. Useegfr(method = ...)andbsa(method = ...)instead. They will become internal in 0.6.0.read_csv_with_hash(),read_parquet_with_hash(),read_sas_with_hash(),read_xpt_with_hash(),read_excel_with_hash(), andread_pzfx_with_hash()now warn on every call (previously a soft deprecation). Useread_file_with_hash().write_csv_with_hash()andwrite_parquet_with_hash()are deprecated. Usewrite_file_with_hash()instead. They will become internal in 0.6.0.
scicalc 0.3.0
New features
- Added
aegfr()function to convert relative eGFR (mL/min/1.73m^2) to absolute eGFR (mL/min). - Added
ibw()(ideal body weight) andaibw()(adjusted ideal body weight) functions. - Added
bmic()(BMI category) function. - Added
agec()(age category) function. - Added
cor_df()function that takes a dataframe and a vector of column names to compute all pairwise correlations. - Added
is_female()andis_black()helper functions for converting character sex/race to logical values. - Added unit conversion functions:
convert_creat(),convert_bili(),convert_alb(). - Added
round_like()function to round numeric values based on explicit or inferred significant digits from a reference value. (Experimental, API may change.)
Improvements
- Computed quantities now include a
unitsattribute for unit tracking:- eGFR functions: “mL/min/1.73m^2” (relative) or “mL/min” (absolute)
-
crcl(): “mL/min” -
bsa(),dubois_bsa(),mosteller_bsa(): “m^2” -
bmi(): “kg/m^2” -
ibw(),aibw(): “kg” -
convert_creat(),convert_bili(): “mg/dL” -
convert_alb(): “g/dL”
- Category functions now include a
category_standardattribute: -
rfc()can now inferabsolute_unitsfrom the input’sunitsattribute, allowingrfc(AEGFR)to work directly without specifying units. - Updated
egfr()equation default to use CKDEPI 2021 equation. - Default hash algorithm changed from md5 to blake3 for
read_file_with_hash()and related functions. - Added recycling warning to all functions when inputs have different lengths.
Deprecations
-
read_csv_with_hash(),read_parquet_with_hash(),read_sas_with_hash(),read_xpt_with_hash(),read_excel_with_hash(), andread_pzfx_with_hash()are soft-deprecated in favor ofread_file_with_hash()which auto-detects file type.
