convert_Cpeptide_units: Convert C-peptide values between standard units

View source: R/convert_Cpeptide_units.R

convert_Cpeptide_unitsR Documentation

Convert C-peptide values between standard units

Description

This function converts C-peptide values between different standard units. As input, it takes the values (as a vector), the input units, and the desired output units. These can be individual timepoints or AUC or mean AUC from an OGTT or MMTT - the function is ambivalent.

Usage

convert_Cpeptide_units(
  values, input_units, output_units, test_minutes = NULL)

Arguments

values

numeric vector C-peptide values. If there are issues with values below the detection threshold, those must be resolved before running this function (i.e. values such as "<0.01" are not allowed)

input_units

character, the input units of the C-peptide values. Options include "ng_per_ml", "nmol_per_l", or less commonly "nmol_per_ml" or "ng_per_l". Each of these can be specified with and without "_per_min" appended. If "_per_min" is included, input values are assumed to be means across the time period of the MMTT or OGTT, and the number of minutes must be specified in test_minutes.

output_units

character, the desired output units of the C-peptide values. Options are the same as for input_units. If "_per_min" is included, output values will be means across the time period of the MMTT or OGTT, and the number of minutes must be specified in test_minutes.

test_minutes

numeric, the number of minutes for the OGTT or MMTT. Ignored if "_per_min" is not included as part of input_units or output_units. If both input and output units use "_per_min", the number of minutes must be the same (you cannot pass two different values for this argument).

Value

a vector containing the C-peptide values, with NA where it could not be calculated


mjdufort/CpeptideTools documentation built on March 5, 2025, 6:58 p.m.