我filter
只想 x1、x2 和 x3 值以及按组id
(但在我的示例中,我没有成功结合across
我的变量(x1、x2 和 x3):
library(dplyr)
data <- tibble::tibble(id= paste0(rep("sample_",length(100)),rep(1:10,10)),x1 = rnorm(100),x2 = rnorm(100),x3 = rnorm(100))
data %>%
group_by(id) %>%
dplyr::filter(across(x1:x3, function(x) x > quantile(x, 0.05)
x < quantile(x, 0.95)))
#Error: Problem with `filter()` input `..1`.
#i Input `..1` is `across(...)`.
#i The error occurred in group 1: id = "sample_1".
请问,有什么想法吗?提前致谢!!