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

pretty print() method would be nice #177

Closed
apsteinmetz opened this issue Jun 8, 2024 · 7 comments
Closed

pretty print() method would be nice #177

apsteinmetz opened this issue Jun 8, 2024 · 7 comments

Comments

@apsteinmetz
Copy link

There is no explicit print method for class duckplyr_df. Something prettier than the base R method would be nice. I use this:

print.duckplyr_df <- function(x,...){print(class(x));print(as_tibble(x),...)}
@krlmlr
Copy link
Member

krlmlr commented Jun 8, 2024

Thanks, Art. A tibble converted to a duckframe will still print as a tibble:

data.frame(a = 1) |>
  duckplyr::as_duckplyr_df()
#>   a
#> 1 1
tibble::tibble(a = 1) |>
  duckplyr::as_duckplyr_df()
#> # A tibble: 1 × 1
#>       a
#>   <dbl>
#> 1     1

Created on 2024-06-08 with reprex v2.1.0

Does this help?

@hadley
Copy link
Member

hadley commented Jul 11, 2024

To me, it feels like creating a tibble should be the default.

@krlmlr
Copy link
Member

krlmlr commented Jul 11, 2024

Should we do

as_duckplyr_df <- function(..., class = class(tibble()))

with an option to override?

@hadley
Copy link
Member

hadley commented Jul 11, 2024

Yeah, I think so.

@krlmlr
Copy link
Member

krlmlr commented Jul 11, 2024

Done in bc7c8de for df_from_file() . Not yet sure about as_duckplyr_df(), it's used in 888 places now, and likely to break.

Maybe as_duckplyr_tibble() and as_duckplyr_tbl() ?

@hadley
Copy link
Member

hadley commented Jul 12, 2024

I think as_duckplyr_tibble() should be adequate.

@krlmlr
Copy link
Member

krlmlr commented Aug 16, 2024

Available in duckplyr 0.4.1.

@krlmlr krlmlr closed this as completed Aug 16, 2024
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

3 participants