Closed esimms999-gsk closed 2 years ago
I don't see the issue. In the call to the derive_param_*()
functions you did not specify set_values_to = vars(AVALU = "something")
so it's expected that you get NA
for that.
If this is confusing we can remove the AVALU
column from the example dataset.
In the first example (for derive_param_map()
) I would add AVALU = "mmHg"
to set_values_to
because if there is a unit variable in the input data, it should be populated for the new observations.
In the second example I would remove AVALU
from the input dataset because it is not used and the output looks inconsistent.
I think the intention of the first example is to show how to call the function if the unit is stored in a separate variable. The second example shows the call for the case that the unit is available in PARAM
only.
The same applies to derive_param_bsa()
and derive_param_bmi()
. For derive_param_bsa()
we should populate PARAM
for the new observations or remove it from the input dataset.
Nice job on using the Bug Report!!
So this is more of a documentation issue and less of a bug? Was thinking we should apply the documentation label??
I am confused about what the get_unit_expr parameter is supposed to be doing. From the example in the derive_param_bmi Help page:
advs <- tibble::tribble( ~USUBJID, ~PARAMCD, ~PARAM, ~AVAL, ~AVALU, ~AVISIT, "01-701-1015", "HEIGHT", "Height (cm)", 147, "cm", "SCREENING", "01-701-1015", "WEIGHT", "Weight (kg)", 54.0, "kg", "SCREENING", "01-701-1015", "WEIGHT", "Weight (kg)", 54.4, "kg", "BASELINE", "01-701-1015", "WEIGHT", "Weight (kg)", 53.1, "kg", "WEEK 2", "01-701-1028", "HEIGHT", "Height (cm)", 163, "cm", "SCREENING", "01-701-1028", "WEIGHT", "Weight (kg)", 78.5, "kg", "SCREENING", "01-701-1028", "WEIGHT", "Weight (kg)", 80.3, "kg", "BASELINE", "01-701-1028", "WEIGHT", "Weight (kg)", 80.7, "kg", "WEEK 2" )
derive_param_bmi ( advs, by_vars = vars(USUBJID, AVISIT), weight_code = "WEIGHT", height_code = "HEIGHT", set_values_to = vars( PARAMCD = "BMI", PARAM = "Body Mass Index (kg/m^2)" ), get_unit_expr = extract_unit(PARAM) )
A tibble: 10 x 6 USUBJID PARAMCD PARAM AVAL AVALU AVISIT
get_unit_expr()
is either a constant like "kg" or an expression that extracts the unit from some exisiting variable in the dataset, in the example PARAM
. Here it pulls out "kg" from WEIGHT
and "cm" for HEIGHT
. It is then checked whether these input units match the expected ones.
Thanks for explaining the get_unit_expr(), Thomas!
I changed the labels from "bug", "programming" to "ADVS", "documentation". I made use of R 3.6.3 to make the following changes:
In derive_advs_params.R:
What happened?
I ran the example code in the Help for each of derive_param_map(), derive_param_bmi() and derive_param_bsa() and noticed that AVALU was not being populated.
For the derive_advs_params.R derivations (MAP, BMI, BSA), the AVALU is NA. Since PARAM for MAP is "Mean Arterial Pressure (mmHg)", I guess the AVALU should be "mmHg" and since the PARAM for BMI is "Body Mass Index (kg/m^2)", I guess the AVALU should be "kg/m^2".
As for BSA, both the PARAM and AVALU are NA. I think the unit for BSA is M^2, but I cannot figure out how that can be since the formula for Mosteller is sqrt[height(cm) * weight(kg) / 3600 ] which should give a unit of ... cm^0.5kg^0.5 ???? This will need some research.
Session Information
Reproducible Example
Run the example code in the help file for each of derive_param_map, bmi, bsa. For example: