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

create sensible $print functions for the different R6 classes #26

Bart6114 opened this Issue Dec 1, 2015 · 4 comments


None yet
2 participants

Bart6114 commented Dec 1, 2015

low priority


> simmer()
    add_generator: function
    add_resource: function
    clone: function
    get_capacity: function
    get_generators: function
    get_mon_arrivals: function
    get_mon_attributes: function
    get_mon_resources: function
    get_n_generated: function
    get_queue_count: function
    get_queue_size: function
    get_resources: function
    get_server_count: function
    initialize: function
    name: anonymous
    now: function
    peek: function
    reset: function
    run: function
    step: function

    mon_gen: NULL
    mon_res: NULL
    sim_obj: externalptr

a minimal example:

Simmer <- R6Class("Simmer",
  public = list(
    print = function() cat(paste0(
      "Simmer instance: ",self$name,"\n",
      "current sim time: ", self$now())),

which results in:

> simmer()
Simmer instance: anonymous
current sim time: 0

@Bart6114 Bart6114 added the enhancement label Dec 1, 2015


This comment has been minimized.


Enchufa2 commented Dec 3, 2015

Some work on this: 9ee806e. I don't know if you had in mind something... nicer. 😄 I didn't feel very... creative, so I confined myself to the trajectory output format.

Note: now Trajectory$print() points to Trajectory$show(), and therefore create_trajectory() and create_trajectory() %>% show_trajectory() do the same.


This comment has been minimized.


Bart6114 commented Dec 4, 2015

It's already a lot better than the raw R6 show function 😄

What about deprecating the show_trajectory function? As simply printing the object returns the same output, I don't really see use for the show_trajectory func.


This comment has been minimized.


Enchufa2 commented Dec 4, 2015

+1. How do we do that? Simply by specifying in the docs "(deprecated)"? Additionally showing a warning?


This comment has been minimized.


Enchufa2 commented Dec 5, 2015

@Enchufa2 Enchufa2 closed this in 4808eb1 Dec 5, 2015

@Enchufa2 Enchufa2 added this to the v3.1.0 milestone Dec 8, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment