Referential class is a class to load, check and manipulate the XLSForm

Referential class is a class to load, check and manipulate the XLSForm

Public fields

data

named list for the referential file

by_groups

survey modules separated by begin and end to manipulate data

path

path for the xlsx file

Methods


Method new()

read the xlsx for each sheet and return a named list

Usage

Referential$new(path)

Arguments

path

path to the file with the full referential

Returns

named list

Examples

ref <- Referential$new(
  path = system.file("SurveyDesigner_Referential.xlsx", package = "surveyDesigner") 
)

head(ref$data$survey)

# Example by groups
ref$by_groups$group_intro


Method get_groups()

get data by groups of begin and end

Usage

Referential$get_groups()


Method clone()

The objects of this class are cloneable with this method.

Usage

Referential$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `Referential$new`
## ------------------------------------------------

ref <- Referential$new(
  path = system.file("SurveyDesigner_Referential.xlsx", package = "surveyDesigner") 
)
#> New names:
#>  `` -> `...14`
#> result is store in `by_groups` sub-element

head(ref$data$survey)
#> # A tibble: 6 × 33
#>   referential_id   type   name  label hint  required required_message constraint
#>   <chr>            <chr>  <chr> <chr> <chr> <chr>    <lgl>            <chr>     
#> 1 household_survey start  start NA    NA    NA       NA               NA        
#> 2 household_survey end    end   NA    NA    NA       NA               NA        
#> 3 household_survey calcu… star… NA    NA    NA       NA               NA        
#> 4 household_survey calcu… end_t NA    NA    NA       NA               NA        
#> 5 household_survey calcu… time… Time… NA    NA       NA               NA        
#> 6 household_survey calcu… time… Time… NA    NA       NA               NA        
#> # ℹ 25 more variables: constraint_message <chr>, relevant <chr>,
#> #   appearance <chr>, calculation <chr>, trigger <lgl>, parameters <lgl>,
#> #   repeat_count <chr>, default <lgl>, read_only <lgl>, choice_filter <chr>,
#> #   `media::image` <lgl>, `$given_name` <chr>, contextualize <lgl>,
#> #   contextualize_instruction <lgl>, block <lgl>, block_sequence <lgl>,
#> #   sequence <lgl>, mode <chr>, check <lgl>, accuracy <lgl>, chapter <lgl>,
#> #   subchapter <lgl>, labelReport <lgl>, hintReport <lgl>, keyword <lgl>

# Example by groups
ref$by_groups$group_intro
#> $data
#> # A tibble: 6 × 33
#>   referential_id   type   name  label hint  required required_message constraint
#>   <chr>            <chr>  <chr> <chr> <chr> <chr>    <lgl>            <chr>     
#> 1 household_survey date   inte… Plea… NA    false    NA               NA        
#> 2 household_survey selec… Bure… Plea… Read… true     NA               NA        
#> 3 household_survey selec… Coun… Plea… Read… true     NA               NA        
#> 4 household_survey calcu… coun… NA    NA    false    NA               NA        
#> 5 household_survey geopo… geop… Reco… NA    false    NA               NA        
#> 6 household_survey selec… pop_… Plea… Read… true     NA               NA        
#> # ℹ 25 more variables: constraint_message <chr>, relevant <chr>,
#> #   appearance <chr>, calculation <chr>, trigger <lgl>, parameters <lgl>,
#> #   repeat_count <chr>, default <lgl>, read_only <lgl>, choice_filter <chr>,
#> #   `media::image` <lgl>, `$given_name` <chr>, contextualize <lgl>,
#> #   contextualize_instruction <lgl>, block <lgl>, block_sequence <lgl>,
#> #   sequence <lgl>, mode <chr>, check <lgl>, accuracy <lgl>, chapter <lgl>,
#> #   subchapter <lgl>, labelReport <lgl>, hintReport <lgl>, keyword <lgl>
#> 
#> $information
#> # A tibble: 2 × 33
#>   referential_id   type   name  label hint  required required_message constraint
#>   <chr>            <chr>  <chr> <chr> <chr> <chr>    <lgl>            <chr>     
#> 1 household_survey begin… grou… Inte… NA    false    NA               NA        
#> 2 household_survey end_g… NA    NA    NA    NA       NA               NA        
#> # ℹ 25 more variables: constraint_message <chr>, relevant <chr>,
#> #   appearance <chr>, calculation <chr>, trigger <lgl>, parameters <lgl>,
#> #   repeat_count <chr>, default <lgl>, read_only <lgl>, choice_filter <chr>,
#> #   `media::image` <lgl>, `$given_name` <chr>, contextualize <lgl>,
#> #   contextualize_instruction <lgl>, block <lgl>, block_sequence <lgl>,
#> #   sequence <lgl>, mode <chr>, check <lgl>, accuracy <lgl>, chapter <lgl>,
#> #   subchapter <lgl>, labelReport <lgl>, hintReport <lgl>, keyword <lgl>
#>