arrow
包包含 37 个 dplyr
表函数的方法,其中许多是用于转换一个或多个表的“动词”。该包还包含 212 个 R 函数到 Arrow 计算库中相应函数的映射。 这允许您在调用 R 函数的 dplyr
方法中编写代码,包括 stringr
和 lubridate
等包中的许多函数,它们将被翻译为 Arrow 并在 Arrow 查询引擎 (Acero) 上运行。 本文档列出了所有映射的函数。
dplyr
动词
大多数动词函数返回一个 arrow_dplyr_query
对象,其精神类似于 dbplyr::tbl_lazy
。 这意味着动词不会急切地评估数据上的查询。 要运行查询,请调用 compute()
(它返回一个 arrow
Table)或 collect()
(它将结果 Table 拉入 R tibble
)。
anti_join()
:copy
参数被忽略distinct()
: 不支持.keep_all = TRUE
full_join()
:copy
参数被忽略inner_join()
:copy
参数被忽略left_join()
:copy
参数被忽略pull()
: 不支持name
参数; 默认情况下返回一个 R 向量,但此行为已被弃用,并在未来的版本中返回一个 Arrow ChunkedArray。 提供as_vector = TRUE/FALSE
来控制此行为,或全局设置options(arrow.pull_as_vector)
。right_join()
:copy
参数被忽略semi_join()
:copy
参数被忽略slice_head()
: 不支持在组内切片; Arrow 数据集没有行顺序,因此 head 是非确定性的;prop
仅支持在nrow()
无需评估即可知晓的查询slice_max()
: 不支持在组内切片; 不支持with_ties = TRUE
(dplyr 默认值);prop
仅支持在nrow()
无需评估即可知晓的查询slice_min()
: 不支持在组内切片; 不支持with_ties = TRUE
(dplyr 默认值);prop
仅支持在nrow()
无需评估即可知晓的查询slice_sample()
: 不支持在组内切片; 不支持replace = TRUE
和weight_by
参数;n
仅支持在nrow()
无需评估即可知晓的查询slice_tail()
: 不支持在组内切片; Arrow 数据集没有行顺序,因此 tail 是非确定性的;prop
仅支持在nrow()
无需评估即可知晓的查询summarise()
: 目前不支持窗口函数; 不支持参数.drop = FALSE
和.groups = "rowwise"
函数映射
在下面的列表中,列出了 Acero 和 R 函数之间行为或支持的任何差异。 如果函数名后没有注释,那么您可以假设该函数在 Acero 中的工作方式与在 R 中相同。
函数可以作为 pkg::fun()
或仅作为 fun()
调用,即 str_sub()
和 stringr::str_sub()
都可以使用。
除了这些函数,您还可以直接调用 Arrow 的 262 个计算函数中的任何一个。 Arrow 有许多没有映射到现有 R 函数的函数。 在其他有 R 函数映射的情况下,如果您不想要 R 映射所具有的使 Acero 行为类似于 R 的调整,您仍然可以直接调用 Arrow 函数。 这些函数在 C++ 文档中列出,并且在 R 的函数注册表中,它们以 arrow_
前缀命名,例如 arrow_ascii_is_decimal
。
base
as.Date()
: Arrow 中不支持多个tryFormats
。 考虑使用 lubridate 专门的解析函数ymd()
、ymd()
等。as.difftime()
: 仅支持units = "secs"
(默认值)data.frame()
: 不支持row.names
和check.rows
参数;stringsAsFactors
必须为FALSE
difftime()
: 仅支持units = "secs"
(默认值); 不支持tz
参数nchar()
: 不支持allowNA = TRUE
和keepNA = TRUE
paste()
: 尚未支持collapse
参数paste0()
: 尚未支持collapse
参数strptime()
: 接受base
函数中不存在的unit
参数。 有效值为 "s"、"ms"(默认值)、"us"、"ns"。substr()
:start
和stop
必须为长度 1
dplyr
case_when()
: 不支持.ptype
和.size
参数
lubridate
dmy()
: 不支持locale
参数dmy_h()
: 不支持locale
参数dmy_hm()
: 不支持locale
参数dmy_hms()
: 不支持locale
参数dpicoseconds()
: 不支持dym()
: 不支持locale
参数fast_strptime()
: 不支持lt
和cutoff_2000
的非默认值force_tz()
: 不支持从非 UTC 时区转换时区; 对于不存在的时间,支持 'error' 和 'boundary' 的roll_dst
值,对于不明确的时间,支持 'error'、'pre' 和 'post' 的roll_dst
值。is.Date()
is.POSIXct()
make_datetime()
: 仅支持 UTC(默认)时区make_difftime()
: 仅支持units = "secs"
(默认值); 不支持同时提供num
和...
mdy()
: 不支持locale
参数mdy_h()
: 不支持locale
参数mdy_hm()
: 不支持locale
参数mdy_hms()
: 不支持locale
参数my()
: 不支持locale
参数myd()
: 不支持locale
参数parse_date_time()
: 不支持quiet = FALSE
可用格式为 H、I、j、M、S、U、w、W、y、Y、R、T。在 Linux 和 OS X 上,还可以使用 a、A、b、B、Om、p、r。ydm()
: 不支持locale
参数ydm_h()
: 不支持locale
参数ydm_hm()
: 不支持locale
参数ydm_hms()
: 不支持locale
参数ym()
: 不支持locale
参数ymd()
: 不支持locale
参数ymd_h()
: 不支持locale
参数ymd_hm()
: 不支持locale
参数ymd_hms()
: 不支持locale
参数yq()
: 不支持locale
参数
stats
median()
: 计算近似中位数 (t-digest)quantile()
:probs
的长度必须为 1; 计算近似分位数 (t-digest)
stringr
任何函数都不支持模式修饰符 coll()
和 boundary()
。
str_c()
: 尚不支持collapse
参数str_count()
:pattern
必须是长度为 1 的字符向量str_split()
: 不支持不区分大小写的字符串拆分以及拆分为 0 个部分str_sub()
:start
和end
的长度必须为 1