r - `across` 是否适用于 dplyr 火花帧的汇总?
问题描述
在使用 a而不是常规时,我遇到了与and动词summarize
结合使用的问题。across
where
tbl_spark
tbl
初始化小标题
temp <- tibble(
a = c(1, 2, NA),
c = c(4, 8, NA),
b = c("A", NA, "B")
)
temp_spark <- sdf_copy_to(sc, temp, "temp_spark")
我的尝试
> temp %>% summarise(across(where(is.numeric), ~mean(.x, na.rm = TRUE)))
# A tibble: 1 x 2
a c
<dbl> <dbl>
1 1.5 6
> temp_spark %>% summarise(across(where(is.numeric), ~mean(.x, na.rm = TRUE)))
Error in UseMethod("escape") :
no applicable method for 'escape' applied to an object of class "function"
解决方案
推荐阅读
- r - 求一列数据的均值
- c - C使用void函数来计算文件的总和
- parsing - C# ANTLR4 DefaultErrorStrategy 或自定义错误侦听器不会捕获无法识别的字符
- kotlin - 如何在 tornadofx 中使用国际化
- xml - 如何总结 xslt 函数返回的值
- jquery - 仅当使用 jquery 单击第一列时如何激活功能?
- python - Django views.py 不呈现 html 文件?
- laravel - laravel 中未定义的变量(头疼)
- ios - iOS 13.4 应用程序崩溃,消息模糊:前提条件失败:类型检查失败:101,预期文本,得到 _HiddenModifier
- c++ - 如何对变量的值进行字符串化?