Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify tbl_df subclass print in a package #650

Open
urswilke opened this issue Sep 1, 2023 · 2 comments
Open

Modify tbl_df subclass print in a package #650

urswilke opened this issue Sep 1, 2023 · 2 comments

Comments

@urswilke
Copy link

urswilke commented Sep 1, 2023

Not sure if this topic belongs here and rather a comment than an issue. I was struggling to have a customized print of a tibble subclass "my_subclass" in a package using pillar.

If I understand correctly, the solution was to add these roxygen2 comments (and then devtools::document()):

#' @importFrom
#' @export

for instance

#' @importFrom pillar tbl_sum
#' @export
tbl_sum.my_subclass <- function(x, ...) {
  c("custom_title_string")
}

I was just wondering if it might be worth to add such a comment to the docs, because I lost too much time with this. For further explanation you can also check out this dummy package that I made to test this and which helped me to find the solution (the R6 part there isn't relevant for this topic I think).

@krlmlr
Copy link
Member

krlmlr commented Sep 1, 2023

Good point. Are you suggesting tweaking https://pillar.r-lib.org/articles/extending.html, or other texts?

@urswilke
Copy link
Author

urswilke commented Sep 2, 2023

Yes I think that would be the best place. It was the article I read most when learning this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants