How can I find help for the `dplyr :: collect` method?

I am trying to figure out what additional arguments can be passed to dplyr::collect in an ellipsis ... I want to do this because I believe that collect behavior has changed between dplyr version 0.4.3 and 0.5 . It seems that in the new version of collect() only the first 100k lines are loaded unless a new argument n = Inf passed.

I got methods related to collect using:

 > methods('collect') [1] collect.data.frame* collect.tbl_sql* see '?methods' for accessing help and source code 

I looked at the help file for S3 methods , but I can’t decide how to get help on collect.tbl_sql , since ?"dplyr::collect.tbl_sql" does not work.

+4
source share
1 answer

As noted by Chrisss and Zheyuan Li :

  • An asterisk / star / * next to a method name after methods is started indicates that each of these methods is not exported from the dplyr namespace.
  • To access the help file, you must use three colons, i.e. ?dplyr:::collect.tbl_sql
  • However, there is no help file for these methods, so we need to study the source code to look at the behavior of each of these functions in the corresponding versions.

In 0.4.3 looking at the tbl-sqr.r in the source code :

 collect.tbl_sql <- function(x, ...) { grouped_df(x$query$fetch(), groups(x)) } 

and 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 behavior of collect really changed as described in my question.

+2
source

Source: https://habr.com/ru/post/1013657/


All Articles