We’ll start by loading dplyr:

library(tabulate)
#> 
#> Attaching package: 'tabulate'
#> The following object is masked from 'package:base':
#> 
#>     tabulate

tabulate()

The most important function of this package is tabulate(): it takes a dataframe and calculates the frequencies or mean of columns. The results can be grouped by any other column and also calculated with another subsample.

tabulate(data = iris,cols = Species)
#> # A tibble: 3 × 6
#>   weight     variable value          n  base   pct
#>   <chr>      <chr>    <chr>      <dbl> <dbl> <dbl>
#> 1 unweighted Species  setosa        50   150 0.333
#> 2 unweighted Species  versicolor    50   150 0.333
#> 3 unweighted Species  virginica     50   150 0.333
tabulate(data = iris,cols = Sepal.Length, return_mean = TRUE)
#> # A tibble: 1 × 7
#>   weight     variable     value       n  base  mean stdev
#>   <chr>      <chr>        <chr>   <dbl> <dbl> <dbl> <dbl>
#> 1 unweighted Sepal.Length numeric   150   150  5.84 0.828