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 on a variable
> ### Aliases: df_stats
> 
> ### ** Examples
> 
> df_stats( ~ hp, data = mtcars)
  min   Q1 median  Q3 max     mean       sd  n missing
1  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)))
   mean_hp trimmed_mean median_hp range_hp_1 range_hp_2 Q_25% Q_75%
1 146.6875     141.1923       123         52        335  96.5   180
> # When using ::, be sure to include parents, even if there are no additional arguments.
> df_stats( ~ hp, data = mtcars, mean = base::mean(), trimmed_mean = base::mean(trim = 0.1))
      mean trimmed_mean
1 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)
  Q_25. Q_75.
1  96.5   180
> # shorter names
> df_stats( ~ hp, data = mtcars, mean, trimmed_mean = mean(trim = 0.1), "median", range,
+   long_names = FALSE)
      mean trimmed_mean median range_1 range_2
1 146.6875     141.1923    123      52     335
> # wide vs long format
> df_stats( hp ~ cyl, data = mtcars, mean, median, range)
  cyl   mean_hp median_hp range_hp_1 range_hp_2
1   4  82.63636      91.0         52        113
2   6 122.28571     110.0        105        175
3   8 209.21429     192.5        150        335
> df_stats( hp ~ cyl, data = mtcars, mean, median, range, format = "long")
   cyl       stat     value
1    4    mean_hp  82.63636
2    6    mean_hp 122.28571
3    8    mean_hp 209.21429
4    4  median_hp  91.00000
5    6  median_hp 110.00000
6    8  median_hp 192.50000
7    4 range_hp_1  52.00000
8    6 range_hp_1 105.00000
9    8 range_hp_1 150.00000
10   4 range_hp_2 113.00000
11   6 range_hp_2 175.00000
12   8 range_hp_2 335.00000
> # More than one grouping variable -- 3 ways.
> df_stats( hp ~ cyl + gear, data = mtcars, mean, median, range)
  cyl gear  mean_hp median_hp range_hp_1 range_hp_2
1   4    3  97.0000      97.0         97         97
2   6    3 107.5000     107.5        105        110
3   8    3 194.1667     180.0        150        245
4   4    4  76.0000      66.0         52        109
5   6    4 116.5000     116.5        110        123
6   4    5 102.0000     102.0         91        113
7   6    5 175.0000     175.0        175        175
8   8    5 299.5000     299.5        264        335
> df_stats( hp ~ cyl | gear, data = mtcars, mean, median, range)
  cyl gear  mean_hp median_hp range_hp_1 range_hp_2
1   4    3  97.0000      97.0         97         97
2   6    3 107.5000     107.5        105        110
3   8    3 194.1667     180.0        150        245
4   4    4  76.0000      66.0         52        109
5   6    4 116.5000     116.5        110        123
6   4    5 102.0000     102.0         91        113
7   6    5 175.0000     175.0        175        175
8   8    5 299.5000     299.5        264        335
> df_stats( hp ~ cyl, groups = gear, data = mtcars, mean, median, range)
  cyl gear  mean_hp median_hp range_hp_1 range_hp_2
1   4    3  97.0000      97.0         97         97
2   6    3 107.5000     107.5        105        110
3   8    3 194.1667     180.0        150        245
4   4    4  76.0000      66.0         52        109
5   6    4 116.5000     116.5        110        123
6   4    5 102.0000     102.0         91        113
7   6    5 175.0000     175.0        175        175
8   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_hp ~ cyl, data = df_stats(hp ~ cyl, data = mtcars, mean),
+     color = ~ "mean") %>%
+   gf_point(median_hp ~ 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


New to ggformula?  Try the tutorials: 
	learnr::run_tutorial("introduction", package = "ggformula")
	learnr::run_tutorial("refining", package = "ggformula")
Error in grid.Call.graphics(C_setviewport, vp, TRUE) : 
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
Calls: <Anonymous> ... push.vp.vpTree -> push.vp -> push.vp.viewport -> grid.Call.graphics
Execution halted