Giter Club home page Giter Club logo

Comments (4)

sckott avatar sckott commented on July 29, 2024 1

the two parameter option sounds good

from taxa.

zachary-foster avatar zachary-foster commented on July 29, 2024

Thinking about this more, the character input (value = "name") should also be accepted, since this is useful for when you have to loop over multiple columns rather than refer to them by name or want to use column index. If its too hard to make it accept both types, then perhaps a new option called exp could be added and either value or exp can be used, but not both.

ex_taxmap$obs("info", exp = sample_1 + sample_2) # OK

ex_taxmap$obs("info", value = "sample_1") # OK

ex_taxmap$obs("info", value = 3) # OK

ex_taxmap$obs("info", value = "sample_1", exp = sample_1 + sample_2) # ERROR

What do you think about having two options for this @sckott? It will be much easier to program than one that accepts both and probably less error prone.

from taxa.

sckott avatar sckott commented on July 29, 2024

hmm, the way i've seen it done and I've done it as well in some pkgs, is to have two fxns, one like foo and another foo_ - where foo() can do e.g. foo(x = bar) and the other does foo_(x = "bar") - and foo_ is called from within foo - or maybe it's better to have parameters as you say above

from taxa.

zachary-foster avatar zachary-foster commented on July 29, 2024

Oh yea, dplyr does that, although I think that was removed in the latest version? I did not think of doing that. Something to consider. I never got the hang of using the two function setup myself.

I hesitate to do that because, I already have the functions like filter_taxa accepts both NSE and SE in the same option, so for consistency, those would perhaps have to be changed to have a filter_taxa_ version. The reason I cannot apply the same logic here is because the value and proposed exp options expect different input. The filter for filter_taxa, is like exp: it just evaluates an expression, with preference to using variables from all_names() over those in global; whatever it evaluates to (ids, indexes, T/F) is what is used to filter. value is expecting a data set name from all_names(). If they was one option in two functions (NSE/SE), the NSE of value would be refer to the contents of a column where the SE value would refer to column names. I find this confusing, and I am not sure where would fit inputing an external variable using SE. Also, I am thinking about letting the subset option use NSE like filter_taxa; what if a user wanted NSE for subset, but not for value or visa versa?

Are you ok with the two-option setup? That seems the most flexible to me.

from taxa.

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.