Coerce to a pivottabler object
to_pivottabler(x, include_column_totals = NULL, include_row_totals = NULL)
x | A pivot_prep or pivot_table object |
---|---|
include_column_totals | Indicates if the column totals are included in the pivot table |
include_row_totals | Indicates if the row totals are included in the pivot table |
pt <- retail_orders %>% pivot_rows(status) %>% pivot_columns(country) %>% pivot_values(n()) %>% to_pivottabler() pt$asMatrix()#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] #> [1,] "" "Australia" "Austria" "Belgium" "Canada" "Denmark" "Finland" #> [2,] "Cancelled" "" "" "" "" "" "" #> [3,] "Disputed" "1" "" "" "" "1" "" #> [4,] "In Process" "1" "" "1" "" "" "" #> [5,] "On Hold" "" "" "" "" "" "" #> [6,] "Resolved" "" "1" "" "" "1" "" #> [7,] "Shipped" "17" "6" "6" "7" "5" "9" #> [8,] "Total" "19" "7" "7" "7" "7" "9" #> [,8] [,9] [,10] [,11] [,12] [,13] [,14] #> [1,] "France" "Germany" "Ireland" "Italy" "Japan" "Norway" "Philippines" #> [2,] "" "" "" "" "" "" "" #> [3,] "" "" "" "" "" "" "" #> [4,] "1" "" "" "" "" "" "" #> [5,] "" "" "" "" "" "" "" #> [6,] "" "" "" "" "" "" "" #> [7,] "36" "7" "2" "8" "6" "9" "3" #> [8,] "37" "7" "2" "8" "6" "9" "3" #> [,15] [,16] [,17] [,18] [,19] [,20] [,21] #> [1,] "Singapore" "Spain" "Sweden" "Switzerland" "UK" "USA" "Total" #> [2,] "" "1" "1" "" "1" "1" "4" #> [3,] "" "1" "" "" "" "" "3" #> [4,] "" "1" "" "" "" "2" "6" #> [5,] "" "" "1" "" "" "3" "4" #> [6,] "" "1" "" "" "" "1" "4" #> [7,] "9" "32" "5" "2" "12" "105" "286" #> [8,] "9" "36" "7" "2" "13" "112" "307"