every time I read the R release notes for the next release, I see many functions that I had forgotten about and many functions that I never knew existed to begin with. (who knew there were bibtex facilities in R? obviously, everyone except me.) I wonder whether there is a complete list of all R commands (incl the standard packages) somewhere, preferably each with its one-liner AND categorization(s). the one-liner can be generated from the documentation. I am thinking one categorization for function area (e.g., "programming related" for, say, deparse; and "statistical model related" for lm; and another categorization for importance (e.g., like "common" for lm and "obscure" for ..). Such categorizations require intelligence. if I am going to do this for myself, I think a csv spreadsheet may be a good idea to make it easy to resort by keys. regards, /iaw ---- Ivo Welch (ivo.welch@gmail.com) [[alternative HTML version deleted]]
R. Michael Weylandt <michael.weylandt@gmail.com>
2013-Apr-04 14:44 UTC
[R] categorized complete list of R commands?
On Apr 4, 2013, at 12:34 AM, ivo welch <ivo.welch at anderson.ucla.edu> wrote:> every time I read the R release notes for the next release, I see many > functions that I had forgotten about and many functions that I never knew > existed to begin with. (who knew there were bibtex facilities in R? > obviously, everyone except me.) > > I wonder whether there is a complete list of all R commands (incl the > standard packages) somewhere, preferably each with its one-liner AND > categorization(s). the one-liner can be generated from the documentation. > I am thinking one categorization for function area (e.g., "programming > related" for, say, deparse; and "statistical model related" for lm; and > another categorization for importance (e.g., like "common" for lm and > "obscure" for ..). Such categorizations require intelligence. > > if I am going to do this for myself, I think a csv spreadsheet may be a > good idea to make it easy to resort by keys.I don't think all if those exist already, but the help system gives indices for each package and, within the core packages, things are relatively well categorized simply by knowing the package they're in. Not a full answer, but perhaps saves you a bit of time. Michael> > regards, > > /iaw > > ---- > Ivo Welch (ivo.welch at gmail.com) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
On Thu, Apr 4, 2013 at 3:57 PM, ivo welch <ivo.welch at gmail.com> wrote:> > thanks, michael. how do I get all functions, not just my own, that can > possibly be used?It's somewhat ill-defined as functions can be created at any moment. But as a start lapply(search(), ls) might get you going. Though my original idea was to access the indices of the HTML help system, with something like help.start() -> packages -> whichever package you want. I'm sure this can all be accessed automatically as well. Also, let's please keep emails on the list and avoid top-posting in so far as possible. Michael>I guess I could just start with each letter and then try > escape for command completion, but this seems silly. ls(environ=parentenv) > did not work (ignore capitalization) at the top level for me. > > /iaw > ---- > Ivo Welch (ivo.welch at gmail.com) > http://www.ivo-welch.info/ > J. Fred Weston Professor of Finance > Anderson School at UCLA, C519 > Director, UCLA Anderson Fink Center for Finance and Investments > Free Finance Textbook, http://book.ivo-welch.info/ > Editor, Critical Finance Review, http://www.critical-finance-review.org/ > > > > On Thu, Apr 4, 2013 at 7:44 AM, R. Michael Weylandt > <michael.weylandt at gmail.com> <michael.weylandt at gmail.com> wrote: >> >> >> >> On Apr 4, 2013, at 12:34 AM, ivo welch <ivo.welch at anderson.ucla.edu> >> wrote: >> >> > every time I read the R release notes for the next release, I see many >> > functions that I had forgotten about and many functions that I never >> > knew >> > existed to begin with. (who knew there were bibtex facilities in R? >> > obviously, everyone except me.) >> > >> > I wonder whether there is a complete list of all R commands (incl the >> > standard packages) somewhere, preferably each with its one-liner AND >> > categorization(s). the one-liner can be generated from the >> > documentation. >> > I am thinking one categorization for function area (e.g., "programming >> > related" for, say, deparse; and "statistical model related" for lm; and >> > another categorization for importance (e.g., like "common" for lm and >> > "obscure" for ..). Such categorizations require intelligence. >> > >> > if I am going to do this for myself, I think a csv spreadsheet may be a >> > good idea to make it easy to resort by keys. >> >> I don't think all if those exist already, but the help system gives >> indices for each package and, within the core packages, things are >> relatively well categorized simply by knowing the package they're in. Not a >> full answer, but perhaps saves you a bit of time. >> >> Michael >> >> >> > >> > regards, >> > >> > /iaw >> > >> > ---- >> > Ivo Welch (ivo.welch at gmail.com) >> > >> > [[alternative HTML version deleted]] >> > >> > ______________________________________________ >> > R-help at r-project.org mailing list >> > https://stat.ethz.ch/mailman/listinfo/r-help >> > PLEASE do read the posting guide >> > http://www.R-project.org/posting-guide.html >> > and provide commented, minimal, self-contained, reproducible code. > >
Here's a categorisation of all the functions in base and utils that I made recently (not sure if the csv will survive posting the list). Feedback welcomed - this was just a quick first pass, and it's not authoritative. Hadley On Thu, Apr 4, 2013 at 12:34 AM, ivo welch <ivo.welch at anderson.ucla.edu> wrote:> every time I read the R release notes for the next release, I see many > functions that I had forgotten about and many functions that I never knew > existed to begin with. (who knew there were bibtex facilities in R? > obviously, everyone except me.) > > I wonder whether there is a complete list of all R commands (incl the > standard packages) somewhere, preferably each with its one-liner AND > categorization(s). the one-liner can be generated from the documentation. > I am thinking one categorization for function area (e.g., "programming > related" for, say, deparse; and "statistical model related" for lm; and > another categorization for importance (e.g., like "common" for lm and > "obscure" for ..). Such categorizations require intelligence. > > if I am going to do this for myself, I think a csv spreadsheet may be a > good idea to make it easy to resort by keys. > > regards, > > /iaw > > ---- > Ivo Welch (ivo.welch at gmail.com) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Chief Scientist, RStudio http://had.co.nz/
On 04 Apr 2013, at 07:34 , ivo welch wrote:> every time I read the R release notes for the next release, I see many > functions that I had forgotten about and many functions that I never knew > existed to begin with. (who knew there were bibtex facilities in R? > obviously, everyone except me.) > > I wonder whether there is a complete list of all R commands (incl the > standard packages) somewhere, preferably each with its one-liner AND > categorization(s). the one-liner can be generated from the documentation. > I am thinking one categorization for function area (e.g., "programming > related" for, say, deparse; and "statistical model related" for lm; and > another categorization for importance (e.g., like "common" for lm and > "obscure" for ..). Such categorizations require intelligence. > > if I am going to do this for myself, I think a csv spreadsheet may be a > good idea to make it easy to resort by keys. > > regards, > > /iaw > > ---- > Ivo Welch (ivo.welch at gmail.com) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.A categorized list of functions would indeed come in handy. So, based on Michael Weylandt's lines, I gave it a try:> # categorize functions.R > # Franklin Bretschneider > # after R-help: R. Michael Weylandt > # 05-04-2013 > # ========================> nprint <- function(x) print(x,quote=FALSE) > allfuncs = unlist(sapply(search(), ls)) > names(allfuncs) <- NULL > patterns = c("print", "plot", "axes", "axis", "color", "file", "read", "write", "load", "save","wave", "image", "table", "data", "apply", "title") > patterns = sort(patterns) # optional > n = length(patterns) > nprint(" ") > nprint(" ") > for (i in 1:n) { > nprint(" ") > nprint(paste("Functions with",patterns[i],":")) > nprint("===============") > nprint(allfuncs[grep(patterns[i], allfuncs, ignore.case=TRUE)]) > nprint("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -") > } > nprint(" ") > nprint(" ") >The list of keywords can be adapted to one's own wishes. Maybe this helps. Best wishes, Franklin -- Franklin Bretschneider Dept of Biology Utrecht University Kruytgebouw W711 Padualaan 8 3584 CH Utrecht The Netherlands
Dear Rees Morrison, Re:> Franklin, I am very impressed. I ran your code and am amazed at the output. I want to use it in my efforts to figure out which are the most widely used functions, so that I can concentrate on understanding those basics reasonably well. > > May I ask you two few questions? > > What additional code would create a table output, with the function name in the left column, sorted alphabetically within a pattern, and the pattern of the function in the column to the right. Users could then sort by those patterns, rename some to suit themselves, etc. >That would be handy, indeed, as well as in which package each function resides. However, my own motive was that if you know the existence and exact name of (seemingly) relevant functions, you can find the full syntax etc. throught R's built-in help system. I'm not sure whether this would be simple, because "grep" yields a variable number of hits, which must then be combined with a fixed string value. I'll think about it.> Second, I assume this function searches base only? Could you add a parameter to the function so that it would search other, installed packages, such as Hmisc or stringr or plyr? If so, the table (or your output) would need to identify the package. >search() gives a list of attached packages, so if you load all packages of your interest you 'll get all relevant functions.> Third, the patterns might usefully include “wd”, “str”, and “names”.Certainly; for others it might be model, summary etc. Users can extend the pattern list or load them from a text file, e.g. patterns = read.csv(file.choose())> > I did not want to post this on R-Help because that site is much too intimidating for a newcomer. In that regard, Hadley Wickham sent the .csv file where he compiled the base functions and stats functions. I have done one of my own, but it is not as comprehensive, but goes beyond base. >In my opinion it's better to CC the r-help, because someone in the vast R community might come up with a faster, or better, solution.> Much obliged. > > Rees > > -- > Rees Morrison > General Counsel Metrics, LLC (management consulting and data analytics) > 4 Hawthorne Ave. > Princeton, NJ 08540-3840 USA > (973) 568-9110 > Hosts www.lawdepartmentmanagementblog.com >Best wishes, Franklin Bretschneider -- Dept Biologie Kruytgebouw W711 Padualaan 8 3584 CH Utrecht The Netherlands [[alternative HTML version deleted]]
On Thu, Apr 4, 2013 at 7:34 AM, ivo welch <ivo.welch at anderson.ucla.edu> wrote:> I wonder whether there is a complete list of all R commands (incl the > standard packages) somewhere, preferably each with its one-liner AND > categorization(s). the one-liner can be generated from the documentation. >Try the 'sos' package. Not exactly what you ask, but close: once you supply a keyword. Liviu