Skip to contents

Write in a file the variable requirement for each single indicator functions

Usage

fct_build_requirement(xlsformpath)

Arguments

xlsformpath

path to the xlsform

Value

print in console

Details

The function is used to conveniently keep the mapping between the excel tables used to show variable requirements for each indicator calculation

It expects a specific table within the xlsform called Indicator_to_question

Examples

## Write in dev/mapper.R each of the function parameters - as recorded in  system.file("IndicMap.xlsx", package = "IndicatorCalc")
xlsformpath <- system.file("RMS_CAPI_v2.xlsx", package = "IndicatorCalc")
RMS_CAPI_v2_mapper <- fct_build_requirement(xlsformpath )
#> /tmp/Rtmp5lKaNB/filec3b542dcd6
# openxlsx::write.xlsx(RMS_CAPI_v2_mapper, here::here("inst", "RMS_CAPI_v2_mapper.xlsx"))

xlsformpath <- system.file("RMS_CAPI_v3.xlsx", package = "IndicatorCalc")
RMS_CAPI_v3_mapper <- fct_build_requirement(xlsformpath )
#> Warning: Expected 2 pieces. Additional pieces discarded in 1 rows [376].
#> /tmp/Rtmp5lKaNB/filec3b5397692d2
# openxlsx::write.xlsx(RMS_CAPI_v3_mapper, here::here("inst", "RMS_CAPI_v3_mapper.xlsx"))

## CATI
xlsformpath <- system.file("RMS_CATI_v0.xlsx", package = "IndicatorCalc")
RMS_CATI_v0_mapper <- fct_build_requirement(xlsformpath )
#> /tmp/Rtmp5lKaNB/filec3b57fd47cd8
# openxlsx::write.xlsx(RMS_CATI_v0_mapper, here::here("inst", "RMS_CATI_v0_mapper.xlsx"))

xlsformpath <- system.file("RMS_CATI_v3.xlsx", package = "IndicatorCalc")
RMS_CATI_v3_mapper <- fct_build_requirement(xlsformpath )
#> Warning: Expected 2 pieces. Additional pieces discarded in 1 rows [326].
#> /tmp/Rtmp5lKaNB/filec3b54498e417
# openxlsx::write.xlsx(RMS_CATI_v3_mapper, here::here("inst", "RMS_CATI_v3_mapper.xlsx"))