3

I always have difficulty in finding all available alternative ways to produce a specific graph, either one that I have already decided to use (looking for different variations) or one that I have not yet thought of.

The R Graphical Manual site provides a complete list of samples of R's graphics functions, however it's easier for me to search providing a package name (how else -for example- can I get a resultset including superbarplot function, when I want to look for barplots?. Let alone that the superbarplot graph does not appear in the results even if I try searching for it's package: UsingR)

The R-SAS-SPSS Add-on Module Comparison - and especially on topic Graphics, Static in the table provided - gave me the idea that it would be nice to have a place where all relevant packages are listed by topic.

Do you have any idea about something like that?

gd047
  • 29,749
  • 18
  • 107
  • 146

4 Answers4

4

If you're interested in learning about all the possible graphics you can make, you should learn about the grammar of graphics, and (my) implementation of it in R: ggplot2.

hadley
  • 102,019
  • 32
  • 183
  • 245
  • :) I agree to a point and I assure you that I have put much effort trying to learn it. However some times I prefer being able to have a choise between several different solutions instead o making one up. – gd047 Jan 29 '10 at 06:36
3

Your question, or the general pattern anyway, was clearly a primary use case for the design of the sos package.

sos actually goes one step further that your question requires by identifying particular functions with packages; in addition, it ranks the results by relevance (by default, you can change the default behavior via the "sortby" parameter, e.g., sortby="Date")

Here's how it works:

most of this package's functionality is exposed via the "findFn" command

for instance, if you want a list of all functions and the parent package related to scatter plots:

findFn("scatter plot", maxPages=2, sortby="TotalScore")

This returns a dataframe formatted as HTML table and delivered in your default browser (if you don't want it to pop-up immediately, then just bind the function call to a variable and then call the variable when you're ready)

The right-most column of the dataframe/HTML page is "Description and Link". Clicking an entry in that column opens another tab in your browser (according to the user-set preferences set in your browser) with the complete R help page for that function.

The results from the function call above show, for instance, that the functions for plotting data in a 'scatter plot' format are found in the following packages:

  • ade4 (function: scatter)
  • IDPmisc (functions: ipairs, iplots)
  • GGally (function: ggally_points)
  • PerformanceAnalytics (function: chart.Scatter)
  • mclust (function: clPairs)

Another example:

findFn("boxplot", maxPages=2, sortby="TotalScore")

identifies these (among others) packages/functions for plotting boxplots:

  • sfsmisc (function: boxplot.matrix)
  • aplpack (function: boxplot2D)
  • NADA (function: boxplot-methods)
  • StatDA (function: rg.boxplot)
  • plotrix (function: gap.boxplot)
  • gplots (function: boxplot.n)
  • multcompView (function: multcompBoxplot)
  • oligo (function: boxplot)
doug
  • 69,080
  • 24
  • 165
  • 199
2

Have you seen the R Graph Gallery ?

Other than that, you may have to index all the source code of CRAN packages to search efficiently...

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • Yes, R Graph Gallery is a site that I use very often (I also use this one http://commons.wikimedia.org/wiki/Category:Created_with_R ). I didn't understand how code indexing is done. Could you explain it? – gd047 Jan 28 '10 at 19:46
  • You would have to download all sources, unpack them, grep for instances of plot(), xyplot(), ... and index that for your convenience. I was trying to say that I doubt such a meta-index exists. That is, outside of the existing R-search engines like Rseek.org etc. – Dirk Eddelbuettel Jan 28 '10 at 20:36
1

these are good memory-joggers. I second the ggplot2 recommend, also recommend looking thru CRAN views:

http://cran.r-project.org/web/views/

http://cran.fhcrc.org/web/views/Graphics.html

(this mirror seems faster in west coast US)


http://dataspora.com/archive/2009/seminar/Survey_of_R_Graphics_by_Driscoll_Dataspora_Jun2009.pdf


http://zoonek2.free.fr/UNIX/48_R/04.html

(possibly world's longest webpage)

http://www.stat.auckland.ac.nz/~ihaka/120/lectures.html

Ihaka's lectures notes

Gene T
  • 5,156
  • 1
  • 24
  • 24