getting error stating "Error: `x` must be a formula"
getting error stating "Error: `x` must be a formula"
我正在使用具有 summary_table 功能的 qwraps2 包。出于某种原因,当我 运行 下面的代码时出现错误 "Error: x
must be a formula"。
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
"n" = sum(death_vs_gender$Deaths),
行似乎省略了一个 ~
。
尝试以下操作:
our_summary1 <-
list("Table 2: Summary Statistics for Mass Shooting Deaths in American between 1966-2017 by Men & Women" =
list(
"n" = ~ sum(Deaths),
"Min" = ~ min(Deaths),
"Max" = ~ max(Deaths),
"Median" = ~ median(Deaths),
"Mean" = ~ mean(Deaths),
"Std. Dev." = ~ sd(Deaths)
)
)
请注意,名称 death_vs_gender
已被省略。调用 summary_table
时,会在提供的 data.frame 中查找变量。此外,从 qwraps2 0.5.0 版开始,不再需要或推荐使用数据代词 .data
。
我正在使用具有 summary_table 功能的 qwraps2 包。出于某种原因,当我 运行 下面的代码时出现错误 "Error: x
must be a formula"。
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
"n" = sum(death_vs_gender$Deaths),
行似乎省略了一个 ~
。
尝试以下操作:
our_summary1 <-
list("Table 2: Summary Statistics for Mass Shooting Deaths in American between 1966-2017 by Men & Women" =
list(
"n" = ~ sum(Deaths),
"Min" = ~ min(Deaths),
"Max" = ~ max(Deaths),
"Median" = ~ median(Deaths),
"Mean" = ~ mean(Deaths),
"Std. Dev." = ~ sd(Deaths)
)
)
请注意,名称 death_vs_gender
已被省略。调用 summary_table
时,会在提供的 data.frame 中查找变量。此外,从 qwraps2 0.5.0 版开始,不再需要或推荐使用数据代词 .data
。