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 – partitioning the display plot

We first visualize the CART_Dummy dataset and then look in the next subsection at how CART gets the patterns, which are believed to exist in the data.

  1. Obtain the dataset CART_Dummy from the RSADBE package by using data( CART_Dummy).
  2. Convert the binary output Y as a factor variable, and attach the data frame with CART_Dummy$Y <- as.factor(CART_Dummy$Y).
    attach(CART_Dummy)

    In Figure 1: A complex classification dataset with partitions, the red squares refer to 0 and the green circles to 1.

  3. Initialize the graphics windows for the three samples by using par(mfrow= c(1,2)).
  4. Create a blank scatter plot:
    plot(c(0,12),c(0,10),type="n",xlab="X1",ylab="X2").
  5. Plot the green circles and red squares:
    points(X1[Y==0],X2[Y==0],pch=15,col="red") ...

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