我想找出可以传递哪些附加参数dplyr::collect
在省略号中...
。我想这样做是因为我相信collect
之间发生了变化dplyr
版本0.4.3
and 0.5
。好像在新版本中collect()
仅下载前 100k 行,除非有新的n = Inf
论证通过。
我已经检索了与相关的方法collect
using:
> methods('collect')
[1] collect.data.frame* collect.tbl_sql*
see '?methods' for accessing help and source code
我查看了S3的帮助文件methods
但不知道如何获得帮助collect.tbl_sql
, as ?"dplyr::collect.tbl_sql"
不起作用。
正如所指出的Chrisss and 李哲元:
- 运行后方法名旁边的星号/星号/*
methods
表示这些方法中的每一个都不是从dplyr
命名空间。
- 要访问帮助文件,需要使用三个冒号,即
?dplyr:::collect.tbl_sql
- 但是,这些方法没有帮助文件,因此我们需要检查源代码以了解每个函数在各自版本中的行为。
In 0.4.3
通过检查tbl-sqr.r
文件在源代码:
collect.tbl_sql <- function(x, ...) {
grouped_df(x$query$fetch(), groups(x))
}
and in 0.5
:
> dplyr:::collect.tbl_sql
function (x, ..., n = 1e+05, warn_incomplete = TRUE)
{
assert_that(length(n) == 1, n > 0L)
if (n == Inf) {
n <- -1
}
sql <- sql_render(x)
res <- dbSendQuery(x$src$con, sql)
on.exit(dbClearResult(res))
out <- dbFetch(res, n)
if (warn_incomplete) {
res_warn_incomplete(res, "n = Inf")
}
grouped_df(out, groups(x))
}
因此,我们可以得出这样的结论:collect
确实按照我的问题中最初描述的方式发生了变化。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)