R/orgsurveyr-data-formats.R
orgsurveyr-data-formats.Rd
The orgsurveyr package works with the following data frame formats:
Data frame with one row per individual in the organisation and variables as multiple columns (wide)
Data frame with multiple rows per individual in the organisation but a fixed number of columns (tall)
Data frame with multiple rows per unit in the organisation and a fixed number of columns (tall)
The get_df_format
and check_df_format
functions can be used to determine and check the data frame format.
#> # A tbl_graph: 38 nodes and 37 edges #> # #> # A rooted tree #> # #> # Node Data: 38 x 4 (active) #> unit_id org_depth is_leaf unit_size #> <chr> <int> <lgl> <dbl> #> 1 1 0 FALSE 3 #> 2 3 1 FALSE 2 #> 3 4 1 FALSE 3 #> 4 5 1 FALSE 3 #> 5 10 2 FALSE 3 #> 6 11 2 FALSE 2 #> # ... with 32 more rows #> # #> # Edge Data: 37 x 2 #> from to #> <int> <int> #> 1 1 2 #> 2 1 3 #> 3 1 4 #> # ... with 34 more rows#> # A tibble: 146 x 5 #> individual_id individual_name unit_id test_var test_var2 #> <chr> <chr> <chr> <dbl> <dbl> #> 1 1 1_1 1 7.27 14.5 #> 2 2 1_2 1 8.53 20.4 #> 3 3 1_3 1 9.21 15.8 #> 4 4 3_1 3 12.9 23.5 #> 5 5 3_2 3 5.02 14.6 #> 6 6 4_1 4 11.0 20.0 #> 7 7 4_2 4 6.33 14.2 #> 8 8 4_3 4 13.8 20.2 #> 9 9 5_1 5 7.48 17.0 #> 10 10 5_2 5 11.7 18.3 #> # ... with 136 more rows#> # A tibble: 146 x 2 #> individual_id unit_id #> <chr> <chr> #> 1 1 1 #> 2 2 1 #> 3 3 1 #> 4 4 3 #> 5 5 3 #> 6 6 4 #> 7 7 4 #> 8 8 4 #> 9 9 5 #> 10 10 5 #> # ... with 136 more rows#> # A tibble: 292 x 3 #> individual_id metric_id value #> <chr> <chr> <dbl> #> 1 1 test_var 7.27 #> 2 2 test_var 8.53 #> 3 3 test_var 9.21 #> 4 4 test_var 12.9 #> 5 5 test_var 5.02 #> 6 6 test_var 11.0 #> 7 7 test_var 6.33 #> 8 8 test_var 13.8 #> 9 9 test_var 7.48 #> 10 10 test_var 11.7 #> # ... with 282 more rows#> # A tibble: 76 x 3 #> unit_id metric_id value #> <chr> <chr> <dbl> #> 1 1 test_var 10.2 #> 2 1 test_var2 20.2 #> 3 10 test_var 10.9 #> 4 10 test_var2 20.2 #> 5 11 test_var 10.4 #> 6 11 test_var2 20.8 #> 7 13 test_var 11.0 #> 8 13 test_var2 19.6 #> 9 14 test_var 10.2 #> 10 14 test_var2 21.1 #> # ... with 66 more rows