O'Reilly logo

R Statistical Application Development by Example Beginner's Guide by Prabhanjan Narayanachar Tattar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – qplot

Here, we will first use the qplot function for obtaining various kinds of plots. To keep the story short, we are using the earlier datasets only and hence, a reproduction of the similar plots using qplot won't be displayed. The reader is encouraged to check ?qplot and its examples.

  1. Load the library with library(ggplot2).
  2. Rearrange the resistivity dataset in a different format and obtain the boxplots:
    test <- data.frame(rep(c("R1","R2"),each=8),c(resistivity[,1], resistivity[,2]))
    names(test) <- c("RES","VALUE")
    qplot(factor(RES),VALUE,data=test,geom="boxplot")

    The gplot function needs to be explicitly specified that RES is a factor variable and according to its levels, we need to obtain the boxplot for the resistivity values. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required