【发布时间】:2019-04-25 13:04:13
【问题描述】:
这是我在这个网站上的第一个问题。
我尝试使用的推断包属于 tidyverse (tidymodels) link
library(tidyverse)
library(rlang)
library(infer)
mtcars$am <- as.factor(mtcars$am)
f <- function(dataset, col){
col <- enquo(col)
bootstrap <- dataset %>%
specify(!!col ~ am ) %>%
generate(reps = 100, type = "bootstrap") %>%
calculate("diff in means", order = c("1", "0"))
}
f(mtcars, mpg)
Error: The response variable `!` cannot be found in this dataframe.The response variable `!col` cannot be found in this dataframe.
In addition: Warning message:
In if (!(as.character(attr(x, "response")) %in% names(x))) { :
Show Traceback
Rerun with Debug
Error: The response variable `!` cannot be found in this dataframe.The response variable `!col` cannot be found in this dataframe.
我已经尝试使用 qq_show 并且一切看起来都很好,所以我不明白这个错误。
【问题讨论】:
标签: r tidyverse rlang tidyeval r-infer