The package formbuildr was designed to readily create forms using the R console or a plain text file. A form is made of a series of questions and post-processing functions combined.

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(formbuildr)

Create a form with R console

Questions

```{R q1} q1 <- fob_int("How old are you?") class(q1)

Various questions with answers of pre-determined types are already implemented. 

```R
R> q1()                                                            
❓ How old are you?
Enter your answer (an integer): 10                                 
✔ validated!
[1] 10

In interactive mode, validation are done interactively.

R> q1()                                                            
❓ How old are you?
Enter your answer (an integer): 10.1                               
⚠ Validation failed, try again!
Enter your answer (an integer): 10                                 
✔ validated!
[1] 10

Combining questions

Post-processing

Create a form from a plain text

Example



inSileco/formbuildr documentation built on Jan. 1, 2021, 4:20 a.m.