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

WIP: tibble_reconstruct(), tibble_row_slice(), tibble_col_modify() #937

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

krlmlr
Copy link
Member

@krlmlr krlmlr commented Jul 31, 2021

For #890.

This PR makes use of new functions tibble_reconstruct(), tibble_row_slice() and tibble_col_modify() that are (almost) identical to the data frame methods of the corresponding dplyr_*() generics. I hope I have caught all instances where these operations should happen.

From there I see two paths:

  1. Call the dplyr methods from tibble if they are available
  2. Define new tibble_*() generics that will be called from dplyr's default method.

It seems that dplyr_col_modify() is inefficient, because it performs repeated lookup of column names in its assignment loop. In tibble, we already know the numeric indices, because we check thoroughly beforehand. I will try to gauge the impact on the performance so that we can make an informed decision.

@jennybc @DavisVaughan @lionel-: Is this something that should be discussed in a tidyup?

@krlmlr
Copy link
Member Author

krlmlr commented Aug 1, 2021

Unfortunately, this is very slow -- I see a slowdown of a factor of 3 for [<- and up to 5 for [[<- . How much slowdown is acceptable if we add this hook?

https://rpubs.com/krlmlr/tibble-reconstruct-benchmark

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.

1 participant