Summary method for pivotr

# S3 method for pivotr
summary(object, perc = FALSE, dec = 3, chi2 = FALSE, shiny = FALSE, ...)

Arguments

object

Return value from pivotr

perc

Display numbers as percentages (TRUE or FALSE)

dec

Number of decimals to show

chi2

If TRUE calculate the chi-square statistic for the (pivot) table

shiny

Did the function call originate inside a shiny app

...

further arguments passed to or from other methods

Details

See https://radiant-rstats.github.io/docs/data/pivotr.html for an example in Radiant

See also

pivotr to create the pivot-table using dplyr

Examples

pivotr(diamonds, cvars = "cut") %>% summary(chi2 = TRUE)
#> Pivot table
#> Data        : diamonds 
#> Categorical : cut 
#> 
#>        cut n_obs
#>       Fair   101
#>       Good   275
#>  Very Good   677
#>    Premium   771
#>      Ideal 1,176
#>      Total 3,000
#> 
#> Chi-squared: 1202.62 df(4), p.value < .001
#> 0.0% of cells have expected values below 5
pivotr(diamonds, cvars = "cut", tabsort = "desc(n_obs)") %>% summary()
#> Pivot table
#> Data        : diamonds 
#> Table sorted: desc(n_obs) 
#> Categorical : cut 
#> 
#>        cut n_obs
#>      Ideal 1,176
#>    Premium   771
#>  Very Good   677
#>       Good   275
#>       Fair   101
#>      Total 3,000
#> 
pivotr(diamonds, cvars = "cut", tabfilt = "n_obs > 700") %>% summary()
#> Pivot table
#> Data        : diamonds 
#> Table filter: n_obs > 700 
#> Categorical : cut 
#> 
#>      cut n_obs
#>  Premium   771
#>    Ideal 1,176
#>    Total 3,000
#> 
pivotr(diamonds, cvars = "cut:clarity", nvar = "price") %>% summary()
#> Pivot table
#> Data        : diamonds 
#> Categorical : cut clarity 
#> Numeric     : price 
#> Function    : mean 
#> 
#>  clarity      Fair      Good Very_Good   Premium     Ideal     Total
#>       I1 2,730.167 4,333.500 3,864.167 4,932.231 6,078.200 4,194.775
#>      SI2 5,893.964 5,280.919 5,045.621 5,568.019 4,435.673 5,100.189
#>      SI1 4,273.069 3,757.022 4,277.544 4,113.811 3,758.125 3,998.577
#>      VS2 3,292.000 3,925.481 3,950.947 4,522.914 3,306.290 3,822.967
#>      VS1 5,110.769 3,740.697 3,889.475 4,461.333 3,189.362 3,789.181
#>     VVS2 2,030.500 4,378.167 2,525.193 3,580.581 3,665.181 3,337.820
#>     VVS1 6,761.500 3,889.333 1,945.875 1,426.692 2,960.594 2,608.460
#>       IF 3,205.000   817.250 4,675.867 2,361.333 1,961.344 2,411.697
#>    Total 4,505.238 4,130.433 3,959.916 4,369.409 3,470.224 3,907.186
#>