Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning RStudio for R Statistical Computing

You're reading from  Learning RStudio for R Statistical Computing

Product type Book
Published in Dec 2012
Publisher Packt
ISBN-13 9781782160601
Pages 126 pages
Edition 1st Edition
Languages
Concepts

Interactive plotting with the manipulate package


During exploratory data analysis, it is often useful to play with the parameters of a graphic. This can be done, of course, in the R console by repeatedly executing the same command and changing the graphical parameters. RStudio includes the manipulate package, that facilitates altering parameters of the current plot.

The manipulate function

The most important function of the manipulate package is manipulate. The value of the first argument of the manipulate function must be an expression or function that generates a plot. Various arguments can be added to define custom sliders, buttons, checkboxes, or pickers (drop-down menus) that are to be used in a small user interface (a manipulator) to manipulate a graphic. The following is an example of a manipulator:

library(manipulate)

manipulate(
 plot( Length ~ Rings, data=abalone
 	, axes = axes
 	, cex = cex
 	, pch = if(pch) 19 else 1
 	)
 , axes = checkbox(TRUE, "Show axes")
 , cex = slider...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}