-
Notifications
You must be signed in to change notification settings - Fork 7
tldr for R functions β³ π #19
Comments
I also wonder whether it would be possible to include a function in the package to create a new description/code pair. The idea being that it is accessible to anyone to create documentation. The tradeoff would be that the barrier to entry (a GitHub account, and the ability to create a PR) is so low that quality may not be maintained. |
Nice idea! Maybe a I was imagining some sort of human review step before merging the PR too, but maybe not, what do you think @danwwilson? |
|
@MilesMcBain could possible chime in here about a lifestyle that avoids loops :) |
TIL about What would also be cool is if the help could have links in it to relevant blog posts etc. To help collect some of the great 3rd party documentation that is out there. Re avoiding loops, this is a great resource I really got a lot out of: https://resources.rstudio.com/webinars/thinking-inside-the-box-you-can-do-that-inside-a-data-frame-april-jenny-bryan |
Yes, a set of clickable links to the helpfile and other resources at the bottom of the page would be ace! |
I think the human review step will likely include quality, however I think the code of conduct should be quite clear on how to handle responses to poorly created documents (I.e not snarky). I was also wondering how namespaces get managed when the same function exists in multiple packages. Does it just become an argument or do we use the :: notation? |
Yes, good point, ensuring maintainers are welcoming is really important! Yeah, I was thinking we could do what tl::dr(stats::glm) or something similar. This: tl::dr("glm", "stats") would be simpler to implement, but requires more typing. |
BTW, there's an implementation of web-hosted helpfiles in this project: https://github.com/zoonproject/zoon which may be worth borrowing from for some of the technical details. I can dig out the relevant bits as/when needed. |
@danwwilson I would think that a function name provided without a namespace would be best to resolve to whatever The
|
Yes, that sounds great @raymondben! function (e1) {
topicExpr <- substitute(e1)
if (is.call(topicExpr) && (topicExpr[[1L]] == "::" || topicExpr[[1L]] == ":::")) {
package <- as.character(topicExpr[[2L]])
topicExpr <- topicExpr[[3L]]
} else {
package <- NULL
}
topic <- if (is.name(topicExpr)) {
as.character(topicExpr)
}
help(topic, package = package)
} |
The package (in progress) is here: https://github.com/ropenscilabs/tl |
TL;DR
create a community-contributed set of quick reference guides for R functions, like the
tldr
project does for the command line.background
There's an awesome command-line tool,
tldr
, that lets you access a community-curated list of quick-reference helpfiles for command-line tools.So when you get into a knotty command-line situation (like this), you can type a quick command and rapidly get common use cases:
Each of those help files is stored as a small markdown document on GitHub, and these pages are contributed by community members (631 contributors and counting for
tldr
). If there isn't a page for the command you type, you're invited to submit a PR:These pages are not intended to replace the documentation for those commands, but they complement them, like cheatsheets do for R package documentation.
There are various interfaces to
tldr
, including an R package on GitHub. These interfaces all provide access to information about command-line tools, not R functions.proposal
Build an equivalent library of quick reference guides for R functions, and a package to call them!
You wouldn't want to load the package before running the command, so I'd propose naming the package
tl
, with a single functiondr
, so you can just load the namespace and get a page rapidly like this:tasks
The text was updated successfully, but these errors were encountered: