Skip to main content

6.2) Finding Functions


Whatever you need to do to your data, there’s a high likelihood that someone has developed a package with functions to do it. First of all, the following steps should help you to track down a relevant function or technique.

  1. For any conventional statistics or data manipulation tools, first see whether there’s a suitable function in any of the standard packages loaded by default. You could call the help file on a related function and look for links under "See also". Or use help.search() with the name of the technique you want (in inverted commas inside the brackets) to search within the packages that are loaded in your current R session. Try several different words before moving to step 2; if you’re getting too many results, enter your key term as a keyword: help.search(keyword= ) (don't forget to use inverted commas).
  2. Go to the Task Views on the CRAN web site and read the short essays under any topics that look relevant, to see if a task like yours is described, and which packages and functions might be useful.
  3. Go to the Search page on the CRAN web site and try searching for your requirement at some of the external web sites listed there, or using the Google search facility. Someone somewhere may have written a useful function that hasn’t yet been loaded onto the official CRAN site (though in this case you should obviously proceed cautiously).

When you’ve found a package that seems to contain what you want, download its PDF manual and search for the right function. This may require patience, as some manuals are more helpful than others!