Here you will find daily news and tutorials about R, contributed by over 573 bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

ggplot2 improves the graphics drawn with R. A (very) short adaptation time is needed to find how to make graphs equivalent to the ones of graphics.

For example, to draw the curve of a function, there is no function similar to curve(). You have to use qplot() by setting the stat and geom arguments as shown below.

First, the ggplot2 package must be installed.

install.packages("ggplot2")

Here, I plot the probability density function of the gamma distribution with parameters /(/alpha = 1/) and /(/beta = 1/) between 1 and 10:

require("ggplot2")
qplot(1:10, stat = "function", geom = "line",
fun = function(x) dgamma(x, shape = 1))

With curve():

curve(dgamma(x, shape = 1), from = 1, to = 10)

The ggplot2 community is fairly active and the web searches with the keyword “ggplot2″ almost always lead to relevant results.

Related

To leave a comment for the author, please follow the link and comment on their blog: Rronan » R.