dupree icon indicating copy to clipboard operation
dupree copied to clipboard

Function for extracting a template of any duplicated code

Open russHyde opened this issue 4 years ago • 0 comments

Say these two code blocks are identified by dupree

my_code <- some_data %>%
   a_really() %>%
   long_pipeline() %>%
   bespoke_function1()
.
.
.
some_data %>%
    a_really %>%
    long_pipeline() %>%
    bespoke_function2()

Is there some way that dupree could take the details of these two code blocks (file / line) and return a template for abstracting out the common code?

new_function <- function(x) {
  x %>% a_really() %>% long_pipeline()
}

russHyde avatar Jul 18 '19 09:07 russHyde