plot.fft() function

Nathaniel Phillips

2016-07-19

Applying the plot() function to an fft object will visualize the tree.

Creating an fft object

Let’s create an fft object called titanic.fft from the titanic dataset.

titanic.fft <- fft(
  formula = survived ~.,
  data = titanic
  )

Plotting a tree

To plot the tree, use plot():

plot(titanic.fft)

You can specify additional arguments to the plot() command that will change what is displayed

For example, let’s plot tree # 4 with which.tree = 4.

plot(titanic.fft, 
     which.tree = 4)

Now let’s apply this tree to a new dataset. I’ll apply the tree to only data from children:

plot(titanic.fft,
     which.tree = 2,
     data = subset(titanic, age == "child")
     )