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

Don't require dplyr anywhere #1131

Merged
merged 2 commits into from
Jun 12, 2023
Merged

Don't require dplyr anywhere #1131

merged 2 commits into from
Jun 12, 2023

Conversation

lorenzwalthert
Copy link
Collaborator

@lorenzwalthert lorenzwalthert commented Jun 11, 2023

Superseeds #1128.

@codecov-commenter
Copy link

Codecov Report

Merging #1131 (a6bb5a1) into main (8f839e6) will increase coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head a6bb5a1 differs from pull request most recent head b6cbe96. Consider uploading reports for the commit b6cbe96 to get more accurate results

@@            Coverage Diff             @@
##             main    #1131      +/-   ##
==========================================
+ Coverage   92.33%   92.35%   +0.01%     
==========================================
  Files          46       46              
  Lines        2650     2654       +4     
==========================================
+ Hits         2447     2451       +4     
  Misses        203      203              
Impacted Files Coverage Δ
R/compat-dplyr.R 93.54% <100.00%> (+0.95%) ⬆️

@github-actions
Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 8f839e6 is merged into main:

  •   :ballot_box_with_check:cache_applying: 202ms -> 206ms [0%, +3.06%]
  •   :ballot_box_with_check:cache_recording: 719ms -> 719ms [-0.54%, +0.5%]
  •   :ballot_box_with_check:without_cache: 1.37s -> 1.37s [-0.14%, +0.54%]

Further explanation regarding interpretation and methodology can be found in the documentation.

@@ -1,16 +1,16 @@
test_that("caching utils make right blocks with semi-colon", {
blocks_simple_uncached <- compute_parse_data_nested(c("1 + 1", "2; 1+1")) %>%
dplyr::mutate(is_cached = FALSE) %>%
mutate(is_cached = FALSE) %>%
Copy link
Contributor

Choose a reason for hiding this comment

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

where's %>% coming from if not dplyr?

Copy link
Contributor

Choose a reason for hiding this comment

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

nvm :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

{magritrr}? We'll at some point transition to |> if minimal supported R version has it.

R/compat-dplyr.R Outdated
@@ -57,3 +57,12 @@ map_dfr <- function(.x, .f, ...) {
res <- map(.x, .f, ...)
vec_rbind(!!!res)
}

mutate <- function(.data, ...) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use base::transform() instead? use case here seems like a drop-in

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok sure.

@github-actions
Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 68977f3 is merged into main:

  •   :ballot_box_with_check:cache_applying: 176ms -> 175ms [-2.53%, +1%]
  •   :ballot_box_with_check:cache_recording: 635ms -> 648ms [-1.36%, +5.27%]
  •   :ballot_box_with_check:without_cache: 1.24s -> 1.24s [-2.43%, +2.66%]

Further explanation regarding interpretation and methodology can be found in the documentation.

select(token, terminal, text, newlines, spaces)

cols <- c('token', 'terminal', 'text', 'newlines', 'spaces')
pd$child[[1]][, cols]
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe subset(pd$child[[1]], select = cols)?

Copy link
Contributor

Choose a reason for hiding this comment

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

or since we've magrittr:

pd$child[[1]] %>%
  subset(select = c(...))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know... the audience of the vignette is probably R developers who know subset() but I think it's one of these functions that are not used often anymore these days... ] is not very pretty here I know but probably easier to understand for most.

Copy link
Contributor

@MichaelChirico MichaelChirico left a comment

Choose a reason for hiding this comment

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

LGTM! Comment is optional/up to preference.

@lorenzwalthert lorenzwalthert merged commit acd0b46 into main Jun 12, 2023
@IndrajeetPatil IndrajeetPatil deleted the rm-dplyr branch November 6, 2023 07:43
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

Successfully merging this pull request may close these issues.

3 participants