Datasets

The package comes with a simulated dataset of HoNOS scores in “wide” format. A helper function can be used to transform this data into “long” format (pivot_honos_longer).

library(honos)
#> This is honos 0.1.1.9001
#> honos is currently in development - function names and arguments might change.
#> PLEASE REPORT ANY BUGS OR IDEAS!

honos_data
#> # A tibble: 18 x 24
#>    id    date       team  stage    q1    q2    q3    q4    q5    q6    q7    q8
#>    <chr> <date>     <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1 id1   2020-01-01 team1 pre       3     3     3     2     0     0     1     2
#>  2 id1   2020-02-11 team1 pre       3     4     3     0     1     1     1     4
#>  3 id1   2020-03-04 team2 pre       2     0     2     1     3     3     2     2
#>  4 id1   2020-04-20 team2 pre       1     2     4     2     2     4     3     4
#>  5 id2   2020-01-14 team1 pre       0     0     2     4     1     0     2     2
#>  6 id2   2020-02-22 team2 pre       1     1     1     2     4     1     4     1
#>  7 id3   2019-05-19 team1 pre       2     2     0     4     4     0     2     4
#>  8 id4   2020-11-08 team1 pre       3     0     1     2     2     0     0     2
#>  9 id4   2021-01-04 team2 pre       4     1     0     0     2     1     1     2
#> 10 id4   2021-01-15 team2 pre       0     2     2     1     0     3     2     4
#> 11 id4   2021-02-14 team1 pre       3     5     1     2     4     1     3     4
#> 12 id4   2020-02-17 team1 pre       2     4     3     4     2     2     2     2
#> 13 id4   2020-02-18 team2 pre       1     3     2     2     0     2     3     1
#> 14 id5   2020-01-01 team1 pre       0     3     4     3     1     4     2     1
#> 15 id5   2020-02-13 team2 pre       1     1     0     2     0     2     1     2
#> 16 id5   2020-03-21 team3 pre       2     2     2     0     3     3     4     1
#> 17 id5   2020-04-08 team2 pre       3     2     2     2     2     0     2     1
#> 18 id5   2020-05-02 team1 pre       0     0     0     1     0     0     0     1
#> # … with 12 more variables: q8_prob <chr>, q8_spec <chr>, q9 <dbl>, q10 <dbl>,
#> #   q11 <dbl>, q12 <dbl>, q13 <dbl>, qa <dbl>, qb <dbl>, qc <dbl>, qd <dbl>,
#> #   qe <dbl>

Although the original variable names in honos_data are somewhat self-explanatory, they are not good! Therefore this package also offers a function to rename the variables (rename_honos()) to be more consistent and allow for easier further data manipulation.


honos_data %>% 
  rename_honos(value_vars_current = c("q1", "q2", "q3", "q4", "q5", "q6", "q7", 
                                      "q8", "q9", "q10", "q11", "q12", "q13"),
               prob_var_item8 = c("q8_prob"),
               spec_var_item8 = c("q8_spec"),
               value_vars_history = c("qa", "qb", "qc", "qd", "qe"))
#> # A tibble: 18 x 24
#>    id    date       team  stage honos_i1_value honos_i2_value honos_i3_value
#>    <chr> <date>     <chr> <chr>          <dbl>          <dbl>          <dbl>
#>  1 id1   2020-01-01 team1 pre                3              3              3
#>  2 id1   2020-02-11 team1 pre                3              4              3
#>  3 id1   2020-03-04 team2 pre                2              0              2
#>  4 id1   2020-04-20 team2 pre                1              2              4
#>  5 id2   2020-01-14 team1 pre                0              0              2
#>  6 id2   2020-02-22 team2 pre                1              1              1
#>  7 id3   2019-05-19 team1 pre                2              2              0
#>  8 id4   2020-11-08 team1 pre                3              0              1
#>  9 id4   2021-01-04 team2 pre                4              1              0
#> 10 id4   2021-01-15 team2 pre                0              2              2
#> 11 id4   2021-02-14 team1 pre                3              5              1
#> 12 id4   2020-02-17 team1 pre                2              4              3
#> 13 id4   2020-02-18 team2 pre                1              3              2
#> 14 id5   2020-01-01 team1 pre                0              3              4
#> 15 id5   2020-02-13 team2 pre                1              1              0
#> 16 id5   2020-03-21 team3 pre                2              2              2
#> 17 id5   2020-04-08 team2 pre                3              2              2
#> 18 id5   2020-05-02 team1 pre                0              0              0
#> # … with 17 more variables: honos_i4_value <dbl>, honos_i5_value <dbl>,
#> #   honos_i6_value <dbl>, honos_i7_value <dbl>, honos_i8_value <dbl>,
#> #   honos_i8_prob <chr>, honos_i8_spec <chr>, honos_i9_value <dbl>,
#> #   honos_i10_value <dbl>, honos_i11_value <dbl>, honos_i12_value <dbl>,
#> #   honos_i13_value <dbl>, honos_i14_value <dbl>, honos_i15_value <dbl>,
#> #   honos_i16_value <dbl>, honos_i17_value <dbl>, honos_i18_value <dbl>

Create long data set

There are two options to create a long data set:

  1. Create a long data set that includes item 8 problem description and additional specification variables pivot = "all_items"

honos_long <- honos_data %>% 
  pivot_honos_longer(value_vars_current = c("q1", "q2", "q3", "q4", "q5", "q6", "q7", 
                                            "q8", "q9", "q10", "q11", "q12", "q13"),
                     prob_var_item8 = c("q8_prob"),
                     spec_var_item8 = c("q8_spec"),
                     value_vars_history = c("qa", "qb", "qc", "qd", "qe"), 
                     pivot = "all_items")

honos_long
#> # A tibble: 360 x 8
#>    id    date       team  stage measure  item type  value
#>    <chr> <chr>      <chr> <chr> <chr>   <dbl> <chr> <chr>
#>  1 id1   2020-04-20 team2 pre   honos       1 value 1    
#>  2 id1   2020-04-20 team2 pre   honos       2 value 2    
#>  3 id1   2020-04-20 team2 pre   honos       3 value 4    
#>  4 id1   2020-04-20 team2 pre   honos       4 value 2    
#>  5 id1   2020-04-20 team2 pre   honos       5 value 2    
#>  6 id1   2020-04-20 team2 pre   honos       6 value 4    
#>  7 id1   2020-04-20 team2 pre   honos       7 value 3    
#>  8 id1   2020-04-20 team2 pre   honos       8 value 4    
#>  9 id1   2020-04-20 team2 pre   honos       8 prob  A    
#> 10 id1   2020-04-20 team2 pre   honos       8 spec  <NA> 
#> # … with 350 more rows
  1. Create a long data set with that includes only scores in long format pivot = "item_scores"

honos_longish <- honos_data %>% 
  pivot_honos_longer(value_vars_current = c("q1", "q2", "q3", "q4", "q5", "q6", "q7", 
                                            "q8", "q9", "q10", "q11", "q12", "q13"),
                     prob_var_item8 = c("q8_prob"),
                     spec_var_item8 = c("q8_spec"),
                     value_vars_history = c("qa", "qb", "qc", "qd", "qe"), 
                     pivot = "item_scores")

honos_longish
#> # A tibble: 324 x 9
#>    id    date       team  stage measure  item value prob  spec 
#>    <chr> <chr>      <chr> <chr> <chr>   <dbl> <dbl> <chr> <chr>
#>  1 id1   2020-04-20 team2 pre   honos       1     1 <NA>  <NA> 
#>  2 id1   2020-04-20 team2 pre   honos       2     2 <NA>  <NA> 
#>  3 id1   2020-04-20 team2 pre   honos       3     4 <NA>  <NA> 
#>  4 id1   2020-04-20 team2 pre   honos       4     2 <NA>  <NA> 
#>  5 id1   2020-04-20 team2 pre   honos       5     2 <NA>  <NA> 
#>  6 id1   2020-04-20 team2 pre   honos       6     4 <NA>  <NA> 
#>  7 id1   2020-04-20 team2 pre   honos       7     3 <NA>  <NA> 
#>  8 id1   2020-04-20 team2 pre   honos       8     4 A     <NA> 
#>  9 id1   2020-04-20 team2 pre   honos       9     2 <NA>  <NA> 
#> 10 id1   2020-04-20 team2 pre   honos      10     3 <NA>  <NA> 
#> # … with 314 more rows