Looking at your data using the plot() function
The plot()
function is one of most powerful functions in base R. The main point of using the plot()
function is that it will always try to print out a representation of your data. It basically tries to figure out which kind of representation is the best, based on the data type. This will let you easily and quickly get a first view of the data you are working with.
Behind the scenes, the power of the plot()
function comes from being packed with a number of methods developed for specific types of object.
So, when an object is passed as an argument to plot()
, it looks for the most appropriate method within the ones available and uses it to represent data stored within the object.
It is even possible to further expand the plot()
function, as is regularly done in various packages, adding new methods for specific types of object by running setMethod()
on it. This is out of the scope of this recipe, but you can find a good explanation in the R language...