---
title: "Development"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{development}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup}
library(XlsFormUtil)
```
# Data examples to demo the package
The included demo [xlsform](https://github.com/unhcr-americas/XlsFormUtil/blob/master/inst/demo.xlsx?raw=true) comes from [https://github.com/pmaengineering/ppp](https://github.com/pmaengineering/ppp)
# fct_xlsfrom_language
```{r example-fct_xlsfrom_language}
## With different language
fct_xlsfrom_language( xlsformpath = system.file("demo.xlsx",
package = "XlsFormUtil"))
## without language
fct_xlsfrom_language( xlsformpath = system.file("KoBoXLSFormExamples.xlsx",
package = "XlsFormUtil"))
```
# fct_interview_duration
```{r examples-fct_interview_duration, fig.width = 9}
## Generate the summary chart
result <- fct_interview_duration(
xlsformpath = system.file("demo.xlsx", package = "XlsFormUtil"),
label_language = NULL,
# wpm word per minute - an average 180 word per minute (per default) required
#to read loudly the text
wpm = 180,
# maxmodalities if more than 7 potential answers for a select question
#(per default)- then we assume that those modalities will not be read by the
# enumerator - but rather selected based on an open answer - and not be
# accounted for the modalities duration estimation
maxmodalities = 7 ,
# resptimeclose an average 4 seconds (per default) for respondent to reply for
# closed questions
resptimeclose = 4,
# resptimecondopen an average of 7 seconds (per default) to reply to conditional
# text question (accounting for question type of "other, please specify").
resptimecondopen = 7,
# resptimeopen an average of 10 seconds (per default) to reply to open text
# question.
resptimeopen = 10,
# avrgrepeat In case of repeat questions, an average 3 repeat (per default) is
# accounted for.
avrgrepeat = 3
)
result[["plot"]]
result[["totaldur"]]
knitr::kable(head(result[["variables"]], 15))
```
# fct_tabulate_form
```{r examples-fct_tabulate_form}
# fct_tabulate_form()
prettyform <- fct_tabulate_form( xlsformpath = system.file("demo.xlsx",
package = "XlsFormUtil") )
knitr::kable(utils::head(prettyform, 10))
```
# fct_create_flextable
```{r examples-fct_create_flextable}
fct_create_flextable(
xlsformpath = system.file("demo.xlsx", package = "XlsFormUtil"),
label_language = NULL )
```
# fct_render_prettyprint
```{r example-fct_render_prettyprint}
# fct_render_prettyprint( dir = system.file("", package = "XlsFormUtil"),
# xlsformfile = "demo.xlsx",
# label_language = NULL )
```
# fct_xlsform_compare
```{r examples-fct_xlsform_compare}
## With 2 files
check <- fct_xlsform_compare(
listfile = c( system.file("demo.xlsx", package = "XlsFormUtil"),
system.file("demo_adapt1.xlsx", package = "XlsFormUtil") ),
label_language = NULL,
fileout = NULL)
# variablescompare,
knitr::kable(utils::head(as.data.frame(check[1]), 10))
# choicescompare
knitr::kable(utils::head(as.data.frame(check[2]), 10, 10))
## With 3 files
check <- fct_xlsform_compare(
listfile = c( system.file("demo.xlsx", package = "XlsFormUtil"),
system.file("demo_adapt1.xlsx", package = "XlsFormUtil"),
system.file("demo_adapt2.xlsx", package = "XlsFormUtil") ),
label_language = NULL,
fileout = NULL)
```
# run_app
```{r example-run_app}
# run_app()
```