Running examples in ‘mosaicCore-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: df_stats
> ### Title: Calculate statistics for "response" variables
> ### Aliases: df_stats
> 
> ### ** Examples
> 
> df_stats( ~ hp, data = mtcars)
  response min   Q1 median  Q3 max     mean       sd  n missing
1       hp  52 96.5    123 180 335 146.6875 68.56287 32       0
> # There are several ways to specify functions
> df_stats( ~ hp, data = mtcars, mean, trimmed_mean = mean(trim = 0.1), "median",
+   range, Q = quantile(c(0.25, 0.75)))
  response     mean trimmed_mean median range_1 range_2 Q_25% Q_75%
1       hp 146.6875     141.1923    123      52     335  96.5   180
> # When using ::, be sure to include parens, even if there are no additional arguments.
> df_stats( ~ hp, data = mtcars, mean = base::mean(), trimmed_mean = base::mean(trim = 0.1))
  response     mean trimmed_mean
1       hp 146.6875     141.1923
> 
> # force names to by syntactically valid
> df_stats( ~ hp, data = mtcars, Q = quantile(c(0.25, 0.75)), nice_names = TRUE)
  response Q_25. Q_75.
1       hp  96.5   180
> # longer names
> df_stats( ~ hp, data = mtcars, mean, trimmed_mean = mean(trim = 0.1), "median", range,
+   long_names = TRUE)
  response  mean_hp trimmed_mean median_hp range_hp_1 range_hp_2
1       hp 146.6875     141.1923       123         52        335
> # wide vs long format
> df_stats( hp ~ cyl, data = mtcars, mean, median, range)
  response cyl      mean median range_1 range_2
1       hp   4  82.63636   91.0      52     113
2       hp   6 122.28571  110.0     105     175
3       hp   8 209.21429  192.5     150     335
> df_stats( hp + wt + mpg ~ cyl, data = mtcars, mean, median, range)
  response cyl       mean  median range_1 range_2
1       hp   4  82.636364  91.000  52.000 113.000
2       hp   6 122.285714 110.000 105.000 175.000
3       hp   8 209.214286 192.500 150.000 335.000
4       wt   4   2.285727   2.200   1.513   3.190
5       wt   6   3.117143   3.215   2.620   3.460
6       wt   8   3.999214   3.755   3.170   5.424
7      mpg   4  26.663636  26.000  21.400  33.900
8      mpg   6  19.742857  19.700  17.800  21.400
9      mpg   8  15.100000  15.200  10.400  19.200
> df_stats( hp ~ cyl, data = mtcars, mean, median, range, format = "long")
# A tibble: 12 × 4
   response   cyl stat    value
   <chr>    <dbl> <chr>   <dbl>
 1 hp           4 mean     82.6
 2 hp           4 median   91  
 3 hp           4 range_1  52  
 4 hp           4 range_2 113  
 5 hp           6 mean    122. 
 6 hp           6 median  110  
 7 hp           6 range_1 105  
 8 hp           6 range_2 175  
 9 hp           8 mean    209. 
10 hp           8 median  192. 
11 hp           8 range_1 150  
12 hp           8 range_2 335  
> # More than one grouping variable -- 4 ways.
> df_stats( hp ~ cyl + gear, data = mtcars, mean, median, range)
  response cyl gear     mean median range_1 range_2
1       hp   4    3  97.0000   97.0      97      97
2       hp   6    3 107.5000  107.5     105     110
3       hp   8    3 194.1667  180.0     150     245
4       hp   4    4  76.0000   66.0      52     109
5       hp   6    4 116.5000  116.5     110     123
6       hp   4    5 102.0000  102.0      91     113
7       hp   6    5 175.0000  175.0     175     175
8       hp   8    5 299.5000  299.5     264     335
> df_stats( hp ~ cyl | gear, data = mtcars, mean, median, range)
  response cyl gear     mean median range_1 range_2
1       hp   4    3  97.0000   97.0      97      97
2       hp   6    3 107.5000  107.5     105     110
3       hp   8    3 194.1667  180.0     150     245
4       hp   4    4  76.0000   66.0      52     109
5       hp   6    4 116.5000  116.5     110     123
6       hp   4    5 102.0000  102.0      91     113
7       hp   6    5 175.0000  175.0     175     175
8       hp   8    5 299.5000  299.5     264     335
> df_stats( hp ~ cyl, groups = ~gear, data = mtcars, mean, median, range)
  response cyl gear     mean median range_1 range_2
1       hp   4    3  97.0000   97.0      97      97
2       hp   6    3 107.5000  107.5     105     110
3       hp   8    3 194.1667  180.0     150     245
4       hp   4    4  76.0000   66.0      52     109
5       hp   6    4 116.5000  116.5     110     123
6       hp   4    5 102.0000  102.0      91     113
7       hp   6    5 175.0000  175.0     175     175
8       hp   8    5 299.5000  299.5     264     335
> df_stats( hp ~ cyl, groups = gear, data = mtcars, mean, median, range)
  response cyl gear     mean median range_1 range_2
1       hp   4    3  97.0000   97.0      97      97
2       hp   6    3 107.5000  107.5     105     110
3       hp   8    3 194.1667  180.0     150     245
4       hp   4    4  76.0000   66.0      52     109
5       hp   6    4 116.5000  116.5     110     123
6       hp   4    5 102.0000  102.0      91     113
7       hp   6    5 175.0000  175.0     175     175
8       hp   8    5 299.5000  299.5     264     335
> 
> # because the result is a data frame, df_stats() is also useful for creating plots
> if(require(ggformula)) {
+   gf_violin(hp ~ cyl, data = mtcars, group = ~ cyl) %>%
+   gf_point(mean ~ cyl, data = df_stats(hp ~ cyl, data = mtcars, mean),
+     color = ~ "mean") %>%
+   gf_point(median ~ cyl, data = df_stats(hp ~ cyl, data = mtcars, median),
+     color = ~"median") %>%
+   gf_labs(color = "")
+ }
Loading required package: ggformula
Loading required package: ggplot2
Loading required package: ggstance

Attaching package: ‘ggstance’

The following objects are masked from ‘package:ggplot2’:

    GeomErrorbarh, geom_errorbarh

Loading required package: scales
Loading required package: ggridges

New to ggformula?  Try the tutorials: 
	learnr::run_tutorial("introduction", package = "ggformula")
	learnr::run_tutorial("refining", package = "ggformula")
Error in duplicated.default(u) : duplicated() applies only to vectors
Calls: %>% ... as.vector -> union -> duplicated -> duplicated.default
Execution halted