flag_anaemia_2 | R Documentation |
Perform anaemia diagnosis based on age, sex and pregnancy status
flag_anaemia_2(df, pop_group = NULL, hb = NULL, add = TRUE)
df |
Survey dataset (as an R data.frame) with the following variables present; sex, age, haemoglobin value, and pregnancy status. If the study sample population did not contain the pregnancy population, the pregnancy status (dummy variable yes/no) might not be required for this function. But, the other variables are compulsory for function processing. If the dataset did not contain those variables, please perform data processing to have those variables in the dataset. | |||||||||||||||||||||||||||||||||||||
pop_group |
This variable contains information about the characteristic of observation required to identify the anaemia status. In anaemia diagnosis, Hb thresholds are different among different populations, such as age group, gender, and special condition (like pregnancy). Therefore, one variable can indicate the type of sample population characteristic requirement for anaemia diagnosis. The required population group for this variable is mentioned in the below table.
if the dataset did not include this variable yet, please create one before
using this function. Sample r code for generating this variable is
mentioned below using the sample dataset df$pop_group <- with(df,ifelse( m.age >= 6 & m.age < 60, 1, ifelse( ch.age >= 5 & ch.age < 12, 2, ifelse( ch.age >= 12 & ch.age < 15, 3, ifelse( ch.age >= 15 & !is.na(ch.age) & sex == 2, 4, ifelse( group == "Pregnant Not Principal Carer" | group == "Pregnant and lactating Principal Carer" | group == "Pregnant Principal carer", 5, ifelse( ch.age >= 15 & !is.na(ch.age) & sex == 1, 6, NA))))))) | |||||||||||||||||||||||||||||||||||||
hb |
Sample observation's haemoglobin level from the dataset. The Hb values should record in the grams per liter (g/L) units. | |||||||||||||||||||||||||||||||||||||
add |
This parameter's default option is TRUE and will add new
generated variables
|
A data frame with the same structure as df
is named
anaemia
. In this new data.frame, the new variable anaemia_all
can be
observed, containing the information which observation was affected by
what type of anaemia: mild, moderate, or severe.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.