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

cat() string in pipeline #61

Closed
renkun-ken opened this issue Nov 11, 2014 · 1 comment
Closed

cat() string in pipeline #61

renkun-ken opened this issue Nov 11, 2014 · 1 comment
Assignees
Milestone

Comments

@renkun-ken
Copy link
Owner

If an expression in a pipeline is character, then it should be cat() directly as side-effect, which is mostly used to indicate pipeline executing progress.

%>>% version:

data(diamonds, package = "ggplot2")
library(pipeR)
library(dplyr)

diamonds %>>%
  "filtering data ..." %>>%
  filter(carat >= quantile(carat, 0.05) & carat <= quantile(carat, 0.95)) %>>%
  "selecting variables ..." %>>%
  select(carat, price, depth) %>>%
  "estimating linear model ..." %>>%
  lm(formula = carat ~ price + depth) %>>%
  "summarizing model ..." %>>%
  summary

pipeline version:

data(diamonds, package = "ggplot2")
library(pipeR)
library(dplyr)

pipeline({
  diamonds
  "filtering data ..."
  filter(carat >= quantile(carat, 0.05) & carat <= quantile(carat, 0.95))
  "selecting variables ..."
  select(carat, price, depth)
  "estimating linear model ..."
  lm(formula = carat ~ price + depth)
  "summarizing model ..."
  summary
})
@renkun-ken renkun-ken self-assigned this Nov 11, 2014
@renkun-ken renkun-ken added this to the 0.5.1 milestone Nov 11, 2014
renkun-ken added a commit that referenced this issue Nov 11, 2014
@renkun-ken
Copy link
Owner Author

An interesting test case is

data(diamonds, package = "ggplot2")
library(pipeR)
library(dplyr)
pipeline({
  diamonds
  "filtering data ..."
  filter(carat >= quantile(carat, 0.05) & carat <= quantile(carat, 0.95))
  ~ Sys.sleep(0.5)
  "selecting variables ..."
  select(carat, price, depth)
  ~ Sys.sleep(0.5)
  "estimating linear model ..."
  lm(formula = carat ~ price + depth)
  ~ Sys.sleep(0.5)
  "summarizing model ..."
  summary
})

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

1 participant