0

I am just learning the gestalt package

one reason I am interested is because it supposed to make clearer error messages for functions deployed with a package

however, the error message looks worse in my initial attempt

# investigate impact of error msg returned by %>% and %>>>%
library(magrittr)
library(gestalt)

pipe.func <- function(x){
  x %>% log %>% c(0, .) %>% pretty %>% tail(1)
}

ges.func <- {
  log %>>>% c(0, .) %>>>% pretty %>>>% tail(1)
}

pipe.func(5); ges.func(5)
pipe.func(-5)
ges.func(-5)

suspect I am thinking of it wrong and would appreciate guidance

KJB
  • 121
  • 6
  • 1
    I looked through the `gestalt` [readme](https://github.com/egnha/gestalt), but didn't find any mention of error-handling. Could you explain a bit further about what you are looking for / need help with? – AkselA Aug 03 '18 at 18:33
  • @AkselA is correct: creating better error messages is not currently one of gestalt's aims. Nonetheless, I agree that the error message you get is not great. (Digression: It turns out that `pipe.func()` and `ges.func()` are not equivalent functions, because `pipe.func()` accepts only one argument, whereas `ges.func()` preserves the formals of the first function, `log()`. Try `ges.func(4, base = 2)` and `pipe.func(4, base = 2)`β€”the latter won't work.) – egnha Aug 03 '18 at 20:04
  • thank you both for taking the time to look into this; suspect I extrapolated as %>% was presented as a foil to %>>%, and error msgs are a known weakness of %>% (https://stackoverflow.com/questions/27947344/r-use-magrittr-pipe-operator-in-self-written-package) – KJB Aug 06 '18 at 13:49

0 Answers0