How do I see the help for the `dplyr::collect` method?

后端 未结 1 556
-上瘾入骨i
-上瘾入骨i 2021-01-13 11:38

I am trying to find out what additional arguments can be passed to dplyr::collect in the ellipsis .... I want to do this because I believe that the

相关标签:
1条回答
  • 2021-01-13 12:08

    As noted by Chrisss and Zheyuan Li:

    1. The asterisk/star/* next to the method name after running methods indicates that each of these methods are not exported from the dplyr namespace.
    2. To access the helpfile, one then needs to use three colons, i.e., ?dplyr:::collect.tbl_sql
    3. However, there is no helpfile for these methods, so we need to examine the source code to look at the behaviour of each of these functions in the respective versions.

    In 0.4.3 by examining tbl-sqr.r file in the source code:

    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))
    }
    

    Thus, we can conclude that the behaviour of collect has indeed changed in the manner originally described in my question.

    0 讨论(0)
提交回复
热议问题