I am using the qwraps2 package that has the summary_table function. For some reason I am getting the error "Error: x must be a formula" when I run the code below.
args(summary_table)
summary_table(death_vs_gender, summaries = qsummary(death_vs_gender))
our_summary1 <- list("Table 2: Summary Statistics for Mass
Shooting Deaths in American between
1966-2017 by Men & Women" = list(
"n" = sum(death_vs_gender$Deaths),
"Min" = ~ min(death_vs_gender$Deaths),
"Max" = ~ max(death_vs_gender$Deaths),
"Median" = ~ median(death_vs_gender$Deaths),
"Mean" = ~ mean(death_vs_gender$Deaths),
"Std. Dev." = ~ sd(death_vs_gender$Deaths)))
whole <- summary_table(death_vs_gender, our_summary1)
whole
There appears to be an
~omitted from the line"n" = sum(death_vs_gender$Deaths),.Try the following:
Note that the name
death_vs_genderhas been omitted. The variables are looked for within the provided data.frame when callingsummary_table. Also, starting with version 0.5.0 of qwraps2, the use of the data pronoun.datais no longer needed or recommended.