design
design copied to clipboard
Tidyverse design principles
When should you use an interactive menu instead of an argument? And how should you do it?
* Tidy design principles * Principle of tidy function design * The design of tidy functions * A philosophy of tidy function design * Design patterns in R Definitely needs...
Generally, the first few lines of a function should assert the type specification of the arguments, using some combination of vctrs, S3 `is` functions, NSE/enquoting functions, and base/rlang scalar type...
i.e. only recycle vectors of length 1 to length of longest. Describe the rules for recycling vectors of length 0. @jimhester did we discuss those rules for glue?
* https://package.elm-lang.org/help/design-guidelines * https://en.m.wikipedia.org/wiki/Unix_philosophy * https://python-patterns.guide * https://martinfowler.com/bliki/BeckDesignRules.html — Passes the tests; Reveals intention; No duplication; Fewest elements
The [boy scout rule](https://deviq.com/boy-scout-rule/) for code is to leave code better than you found it. But I think the full boy scout rule is important: “Always leave the campground cleaner...
Hard to know how to make this precise, but for example it includes things like calling `c()` for its side-effect of stripping attributes, or the way that `substr()` with negative...
Because of the weird type-instability. Almost always clearer to use `tryCatch()`.
As a source of great confusion (but at the risk of another base R example), I think that array subsetting could be an interesting thing to flesh out the painful...