Skip to content

Instantly share code, notes, and snippets.

Last active January 6, 2020 08:09
  • Star 15 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Search for "natural" usage of a function across all CRAN packages

What if a function in a package has no examples? Or is poorly exampled? Wouldn't it be nice to find functioning instances of it "in the wild"?

Via Twitter, Noam Ross taught me a clever way to do such searches on GitHub. Put this into the GitHub search box to see people using the llply() function from plyr:

"llply" user:cran language:R

Or just click here.

This takes advantage of Gábor Csárdi's unofficial read-only mirror of all CRAN R packages:, which also has a pretty webpage:

While I'm at it, I'll also link to Winston Chang's read-only mirror of the R source:

Remember, read the source!

Copy link

hrbrmstr commented Mar 4, 2015

Add this to your .Rprofile and you can save a wee bit of typing, too:

cranex <- function(what) {
  url <- paste("", as.character(substitute(what)), "%22+user%3Acran+language%3AR&ref=searchresults&type=Code&utf8=%E2%9C%93", sep="", collapse="")

so, now you can just do cranex(llply) or cranex("llply") from the R console :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment