Coder Social home page Coder Social logo

ability to rename columns? about roomba HOT 3 OPEN

cstawitz avatar cstawitz commented on June 12, 2024 1
ability to rename columns?

from roomba.

Comments (3)

aedobbyn avatar aedobbyn commented on June 12, 2024

@cboettig nice idea!

The interesting thing about the workhorse function that roomba's wrapped around, dfs_idx is that we can even include a call to filter based on some value, e.g. "givenName" == "Bob". Right now we just check whether there is any value at all with has_good_stuff() inside roomba.

For this v1 we decided not to allow the user to filter in the roomba() call since we weren't sure how the syntax would work. Say you wanted "value" > 42 & "value" =< 100. (What we could do is allow the user to pass a list of all the conditions that they want to be true and then string them together, separated by &s if keep == all and |s if keep == any before passing the conditions into a revamped has_good_stuff.)

Renaming feels like a nice-to-have, but if we were to make the inputs to roomba() allow for more complexity it feels like the a filter might be more useful than a rename.

Would love to hear what you think about allowing for filtering and concatenating the conditionals!

from roomba.

cboettig avatar cboettig commented on June 12, 2024

Very cool. Yeah, it makes total sense to keep the syntax simple even at the cost of features -- we already have a bunch of feature-rich queries like jq that most of us find too complex for regular use.

So I agree that it doesn't make sense to start adding too many different optional arguments inside roomba() function. I do wonder though if a dplyr-esque pipeline syntax might be possible, e.g. a roomba() %>% filter() %>% rename() kind of deal. (might need a lazy-eval strategy where the piped commands are stored and combined into a single operation around a dfs_idx call?)

from roomba.

aedobbyn avatar aedobbyn commented on June 12, 2024

Ah that's a really cool idea! We could even store all the operations the user wants to do and then carry them out in something like

roomba_plan <- 
  roomba(cols = c(x, y z)) %>% 
  filter(x > 4) %>% 
  rename(a = x)

df %>% roomba_execute(roomba_plan)

I suppose it doesn't matter perfomance-wise whether the rename happens in roomba_plan or after roomba_execute() but the filter I can see being useful to pass to dfs_idx rather than doing it after.

from roomba.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.