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 – the bagplot display for a multivariate dataset

  1. Load the aplpack package with library(aplpack).
  2. Check the default examples of the bagplot function with example(bagplot).
  3. Create the panel.bagplot function with:
    panel.bagplot <- function(x,y)
    {
    require(aplpack)
    bagplot(x,y,verbose=FALSE,create.plot = TRUE,add=TRUE)
    }

    Here, the panel.bagplot function is defined to enable us to obtain the bagplot for the upper panel region of the pairs function.

  4. Apply the panel.bagplot function within the pairs function on the Gasoline dataset: pairs(Gasoline[-19,-c(1,4,5,13)],upper.panel =panel.bagplot).

    We obtain the following display:

    Time for action – the bagplot display for a multivariate dataset

    Figure 5: Bagplot ...

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