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

Edits #1

Merged
merged 26 commits into from
Feb 13, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions content/blog/duckplyr-1-0-0/index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -121,29 +121,26 @@ The result can finally be materialized to memory, or computed temporarily, or co

```{r}
# to memory
out
collect(out)

# to a file
csv_file <- withr::local_tempfile()
file.size(csv_file)
compute_csv(out, csv_file)
file.size(csv_file)
fs::file_size(csv_file)
```

When duckplyr itself does not support specific functionality, it falls back to dplyr.
For instance, row names are not supported yet:
For instance, pivoting is not supported yet, still it works thanks to the fallback mechanism.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it potentially confusing since pivoting is tidyr not dplyr.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And nrow() is base, not dplyr 🙃

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Row names too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to avoid the confusion then? Could we use this to highlight how seamless all of this is?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

row names are a characteristic of the data. You cannot use duckplyr with data that have row names or factors.

Now tidyr would be something like the fallbacks needed for select() etc.


```{r}
mtcars |>
summarize(
.by = cyl,
disp = mean(disp, na.rm = TRUE),
sd = sd(disp, na.rm = TRUE)
)
out |>
tidyr::pivot_wider(names_from = prevalence, values_from = babies_n, values_fill = 0L) |>
mutate(share_frequent = frequent / (frequent + rare))
```

Current limitations are documented in a [vignette](https://duckplyr.tidyverse.org/articles/limits.html).
You can change the verbosity of fallbacks, refer to [`duckplyr::fallback_sitrep()`](https://duckplyr.tidyverse.org/reference/fallback.html).
For performance reasons, the output order of the result is not guaranteed to be stable.
If you need a stable order, you can use `arrange()`.
Other limitations are documented in [`vignette("limits")`](https://duckplyr.tidyverse.org/articles/limits.html).

### For large data

Expand Down