Skip to content

Concatenate trajectories #50

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

Closed
Enchufa2 opened this issue May 4, 2016 · 5 comments
Closed

Concatenate trajectories #50

Enchufa2 opened this issue May 4, 2016 · 5 comments
Milestone

Comments

@Enchufa2
Copy link
Member

Enchufa2 commented May 4, 2016

A new verb is needed (for instance, include) so the following:

t.common <- create_trajectory("common") %>%
  seize("receptionist", 1) %>% #Both dogs and cats go to the receptionist
  timeout(function() max(0,rnorm(1,5,2))) %>%
  release("receptionist", 1)

t.cat <- create_trajectory("cat") %>%
  include(t.common) %>%
  seize("catDoc", 1) %>%
  timeout(function() max(0,rnorm(1,30,10))) %>%
  release("catDoc", 1)

t.dog <- create_trajectory("dog") %>%
  include(t.common) %>%
  seize("dogDoc", 1) %>%
  timeout(function() max(0,rnorm(1,30,10))) %>%
  release("dogDoc", 1)

should be equivalent to this:

t.cat <- create_trajectory("cat") %>%
  seize("receptionist", 1) %>% #Both dogs and cats go to the receptionist
  timeout(function() max(0,rnorm(1,5,2))) %>%
  release("receptionist", 1) %>%
  seize("catDoc", 1) %>%
  timeout(function() max(0,rnorm(1,30,10))) %>%
  release("catDoc", 1)

t.dog <- create_trajectory("dog") %>%
  seize("receptionist", 1) %>% #Both dogs and cats go to the receptionist
  timeout(function() max(0,rnorm(1,5,2))) %>%
  release("receptionist", 1) %>%
  seize("dogDoc", 1) %>%
  timeout(function() max(0,rnorm(1,30,10))) %>%
  release("dogDoc", 1)
@Enchufa2
Copy link
Member Author

Enchufa2 commented May 5, 2016

Also, the verb should be intuitive alone, because we may want to do the following:

t0 <- ...
t1 <- ...
t2 <- ...

t3 <- concatenate(t0, t1, t2)

And include doesn't seem very intuitive in this context. We may also look for similar operations in other packages and their names. For instance, I got this:

?? concatenate

base::cat               Concatenate and Print
base::paste             Concatenate Strings
crayon::%+%             Concatenate character vectors
grid::gPath             Concatenate Grob Names
grid::vpPath            Concatenate Viewport Names
igraph::c.igraph.es     Concatenate edge sequences
igraph::c.igraph.vs     Concatenate vertex sequences
NMF::c,NMF-method       Concatenating NMF Models
stringi::%s+%           Concatenate Two Character Vectors
stringi::stri_c         Concatenate Character Vectors
stringr::str_dup        Duplicate and concatenate strings within a
                        character vector.

It seems there is no agreement on this. 😄

@bart6114
Copy link
Member

bart6114 commented May 5, 2016

What about join_trajectories(...) where ... can be any number of trajectories?

@Enchufa2
Copy link
Member Author

Enchufa2 commented May 5, 2016

It's a good option. I would prefer something shorter, but it's difficult to be intuitive, cross-compatible with other packages and also concise.

@Enchufa2
Copy link
Member Author

Enchufa2 commented May 5, 2016

What about simply "join" (only present in plyr, which should be replace by dplyr, or "tjoin" to avoid the overlapping), "blend", "bind" (or "tbind", to mimic "rbind" and "cbind"), "connect", "link", "plug", "tie"...?

@bart6114
Copy link
Member

bart6114 commented May 6, 2016

join is perfect imo; from the syntax it should be clear that we're not calling join to join data.frames (plyr). we're using it in the definition stage of a trajectory. seems nice and concise 😀

@Enchufa2 Enchufa2 added this to the v3.3.0 milestone Jun 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants