Skip to content

Tags not working correctly with branches #21

@swhalemwo

Description

@swhalemwo

just found this package, really fascinating stuff! I played with it a bit to see if I can integrate it in my scripts (I often have many steps, and having access to previous steps would be great), and it seems there is some bug when using tags together branches. In the MWE I perform some operation, save some number on this operation in a branch, and then continue the pipeline.

library(dplyr)
library(rmonad)

m <- as_monad(as_tibble(iris)) %>% tag('input')%>>%
        dplyr::filter(Species == "setosa") %>% tag('filter1') %>^%
        nrow %>% tag("nrow") %>>%
        dplyr::filter(Sepal.Width > 3) %>% tag("filter2")

However, I haven't found a way to assess the information I saved in the nrow tag: get_value(m, tag = "nrow") and view(m, "nrow") both return the dataset at the filter1 tag. My hunch is that it is related to get_tag(m), since the third node is an empty list:

[[1]]
[[1]][[1]]
[1] "input"


[[2]]
[[2]][[1]]
[1] "filter1"

[[2]][[2]]
[1] "nrow"


[[3]]
list()

[[4]]
[[4]][[1]]
[1] "filter2"

If I add another branch, I get even more empty lists:

m2 <- as_monad(as_tibble(iris)) %>% tag('input')%>>%
        dplyr::filter(Species == "setosa") %>% tag('filter1') %>^%
        nrow %>% tag("nrow") %>^%
        ncol %>% tag("ncol") %>>%
        dplyr::filter(Sepal.Width > 3) %>% tag("filter2")

get_tag(m2)

[[1]]
[[1]][[1]]
[1] "input"


[[2]]
[[2]][[1]]
[1] "filter1"

[[2]][[2]]
[1] "nrow"

[[2]][[3]]
[1] "ncol"


[[3]]
list()

[[4]]
list()

[[5]]
[[5]][[1]]
[1] "filter2"

Is it possible to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions