1

I have an R object lf which is an element of the class tbl_lazy:

library(dbplyr)
lf <- lazy_frame(a = TRUE, b = 1, c = 2, d = "z", con = simulate_hana())
>class(lf)
[1] "tbl_HDB"  "tbl_lazy" "tbl"

With the help of the sloop package, I can see that the generic function print.tbl_lazy is set to visible = FALSE. This seems to be the reason why printing print.tbl_lazy returns Error: object 'print.tbl_lazy' not found.

   generic       class    visible source
   <chr>         <chr>    <lgl>   <chr>
11 print         tbl_lazy FALSE   registered S3method

When I debug print I see the call to print.lazy and can now see the content of print.tbl_lazy.

debugging in: function (x, ...)
UseMethod("print")(x)
debug: UseMethod("print")
Browse[2]> n
debugging in: print.tbl_lazy(x)
debug: {
    show_query(x)
}

My question is why are all the methods of the class tbl_lazy set to visible = FALSE and what are the consequences of this? It would appear to me, while it may have some advantages, whatever they might be, it makes the code of the method more difficult to access, which in a language like R, used by so many non technical users, seems to be a big disadvantage.
I wasn't able to find any documentation on this.

jamoreiras
  • 315
  • 1
  • 14

0 Answers0