{"action":"opened","issue":{"url":"https://api.github.com/repos/DeclareDesign/DeclareDesign/issues/239","repository_url":"https://api.github.com/repos/DeclareDesign/DeclareDesign","labels_url":"https://api.github.com/repos/DeclareDesign/DeclareDesign/issues/239/labels{/name}","comments_url":"https://api.github.com/repos/DeclareDesign/DeclareDesign/issues/239/comments","events_url":"https://api.github.com/repos/DeclareDesign/DeclareDesign/issues/239/events","html_url":"https://github.com/DeclareDesign/DeclareDesign/issues/239","id":333442600,"node_id":"MDU6SXNzdWUzMzM0NDI2MDA=","number":239,"title":"allowing functions and function calls to be in designs","user":{"login":"graemeblair","id":3320015,"node_id":"MDQ6VXNlcjMzMjAwMTU=","avatar_url":"https://avatars2.githubusercontent.com/u/3320015?v=4","gravatar_id":"","url":"https://api.github.com/users/graemeblair","html_url":"https://github.com/graemeblair","followers_url":"https://api.github.com/users/graemeblair/followers","following_url":"https://api.github.com/users/graemeblair/following{/other_user}","gists_url":"https://api.github.com/users/graemeblair/gists{/gist_id}","starred_url":"https://api.github.com/users/graemeblair/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graemeblair/subscriptions","organizations_url":"https://api.github.com/users/graemeblair/orgs","repos_url":"https://api.github.com/users/graemeblair/repos","events_url":"https://api.github.com/users/graemeblair/events{/privacy}","received_events_url":"https://api.github.com/users/graemeblair/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-18T21:32:03Z","updated_at":"2018-06-18T21:32:03Z","closed_at":null,"author_association":"MEMBER","body":"We've discussed allowing various types of non-DD objects into the design creation pipelines, including:\r\n1) bare function names i.e. `pop + my_func`\r\n2) function calls i.e. `pop + my_func(n = 50)` including dplyr function calls i.e. `pop + mutate(q = 5)`\r\n3) dplyr pipelines i.e. `pop + . %>% group_by(my_group_var) %>% summarize(est = mean(y)`\r\n\r\nI'd like all three to work in some way, if not with this syntax. \r\n\r\nAlex and I worked out case (a) in PR https://github.com/DeclareDesign/DeclareDesign/pull/238\r\n\r\nThat PR also includes a broken example for (2) that illustrates how we can't get it to work.\r\n\r\nHere's what happens: \r\n\r\n```\r\n> my_func <- function(data, my_n = 50){\r\n+     data %>% sample_n(n = my_n)\r\n+   }\r\n> # errors before sending to our operator function\r\n>   my_pop + my_func(my_n = 50)\r\n Show Traceback\r\n \r\n Rerun with Debug\r\n Error in eval(lhs, parent, parent) : \r\n  argument \"data\" is missing, with no default \r\n```\r\n\r\ni.e. it tries to evaluate my_func(my_n = 50) before sending it to our + operator function.\r\n\r\nThoughts on doing (1)-(3) and also ideas on how to fix this problem appreciated! The error seems related to this set of comments by @nfultz : https://github.com/DeclareDesign/DeclareDesign/pull/216#issuecomment-395223138"}}
{"actor":{"display_login":"graemeblair"}}