generate random data for xlsforms (kobo/odk..) devtools::install_github("https://github.com/impact-initiatives/xlsformfill")
CAR_Enabel_kobo_v3_survey <- read_excel("xxx/CAR_Enabel_kobo_v3.xlsx", sheet = "survey")
CAR_Enabel_kobo_v3_choice <- read_excel("xxx/CAR_Enabel_kobo_v3.xlsx",
sheet = "choices")
CAR_Enabel_kobo_v3_choice <- CAR_Enabel_kobo_v3_choice %>%
rename(list_name = list name
)
set.seed(12333) test1 <- xlsformfill::xlsform_fill(CAR_Enabel_kobo_v3_survey, CAR_Enabel_kobo_v3_choice, n = 100)
CAR_Enabel_kobo_v3_survey_label <- CAR_Enabel_kobo_v3_survey
CAR_Enabel_kobo_v3_survey_label <- CAR_Enabel_kobo_v3_survey_label %>%
mutate(name = if_else(is.na(label::francais (fr)
), name, label::francais (fr)
))
CAR_Enabel_kobo_v3_survey_label %>% head()
CAR_Enabel_kobo_v3_choice_label <- CAR_Enabel_kobo_v3_choice
CAR_Enabel_kobo_v3_choice_label <- CAR_Enabel_kobo_v3_choice_label %>%
mutate(name = if_else(is.na(label::francais (fr)
), name, label::francais (fr)
))
CAR_Enabel_kobo_v3_choice %>% head() set.seed(12333) test2 <- xlsformfill::xlsform_fill(CAR_Enabel_kobo_v3_survey_label, CAR_Enabel_kobo_v3_choice, n = 100)
xls_format <- test1 label_format <- test2
writexl::write_xlsx(list(xls_format, label_format), "test_kobo.xlsx")