Skip to content
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

Interfacing with data.tree #72

Open
schnorr opened this issue Feb 21, 2017 · 0 comments
Open

Interfacing with data.tree #72

schnorr opened this issue Feb 21, 2017 · 0 comments

Comments

@schnorr
Copy link

schnorr commented Feb 21, 2017

I've tried pipeR + the data.tree package, but pipelining won't work. The problem is that data.tree functions (such as Prune) change the object in-place, returning something unrelated with the object passed as parameter. Would you have an idea on how to interface with data.tree properly? I'd like to be able to do something like this:

library(data.tree);
library(pipeR);
atree <- df %>>%
          as.Node(mode="network") %>>%
          Prune(function(node) node$name != "data") %>>%
          Prune(function(node) !(node$Nature %in% c("Link", "Event")));

Normally, Prune expects a tree object in its first parameter, like this:

 Prune(atree, function(node) node$name != "data");

So, I was expecting in using the . to mark, such as this:

atree <- df %>>%
          as.Node(mode="network") %>>%
          Prune(., function(node) node$name != "data") %>>%
          Prune(., function(node) !(node$Nature %in% c("Link", "Event")));

But the problem is that Prune always returns the number of nodes removed. How can I tell pipeR to consider the modified . as input for the next Prune call? Is that possible?

Thanks for this nice package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant