Code Monkey home page Code Monkey logo

Comments (3)

bart6114 avatar bart6114 commented on June 1, 2024

If we want this, we will have to create some minimal 'dummy' functions. Consider the example below.

library(R6)

testClass<-
  R6Class("test",
          public=list(
            bar=c(),
            foo=function(value){
              self$bar<-c(self$bar, value)
              invisible(self)
            }
          )
  )

test<-function() testClass$new()
foo<-function(test_instance, value) test_instance$foo(value)
bar<-function(test_instance) test_instance$bar

library(magrittr) # should be imported automatically upon loading package

test() %>%
  foo(1) %>%
  foo(2) %>%
  foo(3) %>%
  bar()

[1] 1 2 3

While it doesn't improve function at all, I believe it does improve usability as the average R user IMO is much more familiar with the %>% syntax. Therefor, it's a nicety but not a priority.

As a side note, if we ever step away from the R6 approach, it think it will be (relatively) easier to maintain a steady syntax using %>% instead of when using $.

from simmer.

Enchufa2 avatar Enchufa2 commented on June 1, 2024

Mmh... interesting. I'll postpone the submission to CRAN in order to take a look at this. :-)

from simmer.

Enchufa2 avatar Enchufa2 commented on June 1, 2024

Done! Thanks for your feedback!

from simmer.

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.