Skip to Main Content
Beyond Spreadsheets with R
book

Beyond Spreadsheets with R

by Jonathan Carroll
January 2019
Beginner to intermediate content levelBeginner to intermediate
352 pages
9h 8m
English
Manning Publications
Content preview from Beyond Spreadsheets with R

appendix C Graphics in base R

This appendix provides an alternative solution to the problem of visualizing data. There are many reasons why ggplot2 can be seen as a superior method of visualizing data, not least of which is the sophisticated application of the “grammar of graphics” philosophy. That’s not to say that what you’re about to see is useless, but as you learn more about ggplot2, you’ll have fewer and fewer reasons to ever use these functions.

The simplest way to generate a base plot is to call plot() with vectors of x and y data, as in figure C.1:

plot(x = mtcars$disp, y = mtcars$mpg)

You’ll notice a few major differences in how this is written and what is produced. First, since you’re passing vectors (not bare names of columns), ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Graphical Data Analysis with R

Graphical Data Analysis with R

Antony Unwin
Regression Analysis with R

Regression Analysis with R

Giuseppe Ciaburro, Pierre Paquay, Manoj Kumar, Shaikh Salamatullah
Advanced Machine Learning with R

Advanced Machine Learning with R

Cory Lesmeister, Dr. Sunil Kumar Chinnamgari

Publisher Resources

ISBN: 9781617294594Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentPurchase Link