Package manipulate. February 20, 2015

Similar documents
NICK COLLIER - REPAST DEVELOPMENT TEAM

Package polynom. R topics documented: June 24, Version 1.3-8

Package tagcloud. R topics documented: July 3, 2015

Package erp.easy. September 26, 2015

Package sendmailr. February 20, 2015

Package plan. R topics documented: February 20, 2015

Package RIGHT. March 30, 2015

Package treemap. February 15, 2013

Getting Started with R and RStudio 1

Package bigdata. R topics documented: February 19, 2015

Portal Connector Fields and Widgets Technical Documentation

Logi Ad Hoc Reporting System Administration Guide

Package retrosheet. April 13, 2015

Package date. R topics documented: February 19, Version Title Functions for handling dates. Description Functions for handling dates.

UCSF Academic Research Systems

Package uptimerobot. October 22, 2015

NINTEX WORKFLOW TIPS AND TRICKS. Eric Rhodes

Excel Using Pivot Tables

Color Swatches Pro. Magento Extension User Guide. Official extension page: Color Swatches Pro. User Guide: Color Swatches Pro

Microsoft Excel 2010 Part 3: Advanced Excel

Using Excel for Data Manipulation and Statistical Analysis: How-to s and Cautions

RANGER S.A.S 3D (Survey Analysis Software)

Package ggrepel. February 8, 2016

Formulas, Functions and Charts

Using Flow Control with the HEAD Recorder

Chapter 32 Histograms and Bar Charts. Chapter Table of Contents VARIABLES METHOD OUTPUT REFERENCES...474

Using Excel for Statistical Analysis

The following is an overview of lessons included in the tutorial.

Petrel TIPS&TRICKS from SCM

Graphics in R. Biostatistics 615/815

Scatter Plots with Error Bars

ICP Data Validation and Aggregation Module Training document. HHC Data Validation and Aggregation Module Training Document

Package SHELF. February 5, 2016

Fixplot Instruction Manual. (data plotting program)

Synthesys Call Recycling

Appendix 2.1 Tabular and Graphical Methods Using Excel

SharePoint List Filter Webpart User Manual

Scientific Graphing in Excel 2010

Aras Corporation Aras Corporation. All rights reserved. Notice of Rights. Notice of Liability

Excel Using Pivot Tables

Microsoft Access 3: Understanding and Creating Queries

GoMage Advanced Navigation Extension v.2.2

Package TSfame. February 15, 2013

[Jet-Magento Integration]

A Short Guide to R with RStudio

SafeSeaNet Norway User Registration Guide

WEKA Explorer User Guide for Version 3-4-3

Package png. February 20, 2015

Resco Mobile CRM Woodford (Rules Guide) Document version

Sign-up Tool User Manual

UOFL SHAREPOINT ADMINISTRATORS GUIDE

For another way to generate recursive sequences, see Calculator Note 1D.

Each function call carries out a single task associated with drawing the graph.

GeoGebra Statistics and Probability

Analysis of System Performance IN2072 Chapter M Matlab Tutorial

Package empiricalfdr.deseq2

Visualization with OpenDX

Package wordnet. January 6, 2016

EET 310 Programming Tools

Tutorial 3: Graphics and Exploratory Data Analysis in R Jason Pienaar and Tom Miller

Data Tool Platform SQL Development Tools

TIBCO Spotfire Business Author Essentials Quick Reference Guide. Table of contents:

Nintex Forms 2013 Help

Creating Database Tables in Microsoft SQL Server

RapidMiner 5.2: Advanced Charts

How Does My TI-84 Do That

Package tikzdevice. February 20, 2015

Logi Ad Hoc Reporting Report Design Guide

rma_product_return version BoostMyShop

Learning Management System

13-1. This chapter explains how to use different objects.

Event Log. Chapter 7 Event Log Event Log Management Excel Editing Create a New Event Log... 9

Package hive. January 10, 2011

Gestation Period as a function of Lifespan

Controlling User Typed Responses for Fill-in Questions

Creating forms in Microsoft Access 2007

GAMBIT Demo Tutorial

CREATE A 3D MOVIE IN DIRECTOR

EXERCISE 6: CREATING A FUSION PROJECT PART 1

Hotspot Image Connector Page Guide

not at all a manual simply a quick how-to-do guide

Gateway2Travel Manual

Package hive. July 3, 2015

Microsoft Office Live Meeting Events User s Guide

Working with Video in PowerPoint 2010

Data exploration with Microsoft Excel: univariate analysis

STATGRAPHICS Online. Statistical Analysis and Data Visualization System. Revised 6/21/2012. Copyright 2012 by StatPoint Technologies, Inc.

DocuSign Connect for Salesforce Guide

Package treemap. October 14, 2015

IBM SPSS Data Preparation 22

Sample- for evaluation purposes only. Advanced Crystal Reports. TeachUcomp, Inc.

Package packrat. R topics documented: March 28, Type Package

Elluminate Live! Troubleshooting Guide

Statgraphics Getting started

FactoryTalk Alarm & Events

Quosal Form Designer Training Documentation

How to integrate Verax NMS & APM with Verax Service Desk

Transcription:

Type Package Title Interactive Plots for RStudio Version 1.0.1 Date 2014-12-23 Maintainer JJ Allaire <jj@rstudio.com> Package manipulate February 20, 2015 Interactive plotting functions for use within RStudio. The manipulate function accepts a plotting expression and a set of controls (e.g. slider, picker, checkbox, or button) which are used to dynamically change values within the expression. When a value is changed using its corresponding control the expression is automatically re-executed and the plot is redrawn. Depends R (>= 2.11.1) SystemRequirements RStudio - http://www.rstudio.com/products/rstudio/ License GPL-2 LazyLoad yes Author JJ Allaire [aut, cre] (R interface), RStudio [cph] NeedsCompilation no Repository CRAN Date/Publication 2014-12-24 01:18:44 R topics documented: manipulate-package..................................... 2 button............................................ 3 checkbox.......................................... 4 isavailable......................................... 5 manipulate.......................................... 5 Manipulator Custom State................................. 7 manipulatormouseclick.................................. 8 picker............................................ 8 slider............................................ 10 1

2 manipulate-package Index 12 manipulate-package Interactive Plots for RStudio Details Interactive plotting functions for use within RStudio. The manipulate function accepts a plotting expression and a set of controls (e.g. slider, picker, checkbox, or button) which are used to dynamically change values within the expression. When a value is changed using its corresponding control the expression is automatically re-executed and the plot is redrawn. For example, to create a plot that enables manipulation of a parameter using a slider control you could use syntax like this: plot(1:x), x = slider(1, 10)) After this code is executed the plot is drawn using an initial value of 1 for x. A manipulator panel is also opened adjacent to the plot which contains a slider control used to change the value of x from 1 to 10. ## Create a plot with a manipulator plot(1:x), x = slider(5, 10)) ## Using more than one slider plot(cars, xlim=c(x.min,x.max)), x.min=slider(0,15), x.max=slider(15,30)) ## Filtering data with a picker barplot(as.matrix(longley[,factor]), beside = TRUE, main = factor), factor = picker("gnp", "Unemployed", "Employed")) ## Create a picker with labels plot(pressure, type = type), type = picker("points" = "p", "line" = "l", "step" = "s")) ## Toggle boxplot outlier display using checkbox boxplot(freq ~ Class, data = Titanic, outline = outline),

button 3 outline = checkbox(false, "Show outliers")) ## Combining controls plot(cars, xlim = c(x.min, x.max), type = type, axes = axes, ann = label), x.min = slider(0,15), x.max = slider(15,30, initial = 25), type = picker("p", "l", "b", "c", "o", "h", "s", "S", "n"), axes = checkbox(true, "Draw Axes"), label = checkbox(false, "Draw Labels")) button Create a button control Create a button control to enable triggering of conditional actions within manipulate expressions. When the user presses the button the manipulate expression will be executed with its associated value set to TRUE (in all other cases the value will be set to FALSE). button(label) Arguments label Label for button. See Also An object of class "manipulator.button" which can be passed to the manipulate function. manipulate, slider, picker, checkbox ## use a button to reset a random seed { if(resetseed) set.seed(sample(1:1000)) hist(rnorm(n=100, mean=0, sd=3), breaks=bins)

4 checkbox }, bins = slider(1, 20, step=1, initial =5, label="bins"), resetseed = button("reset Seed") ) checkbox Create a checkbox control Create a checkbox control to enable manipulation of logical plot variables. checkbox(initial = FALSE, label = NULL) Arguments initial label Initial value for checkbox. Must be logical (defaults to FALSE). Display label for checkbox. Defaults to the variable name if not specified. See Also An object of class "manipulator.checkbox" which can be passed to the manipulate function. manipulate, slider, picker, button ## Using checkboxes for boolean parameters plot(cars, axes = axes, ann = label), axes = checkbox(true, "Draw Axes"), label = checkbox(false, "Draw Labels")) ## Toggle boxplot outlier display using checkbox boxplot(freq ~ Class, data = Titanic, outline = outline), outline = checkbox(false, "Show outliers"))

isavailable 5 isavailable Check whether manipulate is available Check whether manipulate is available in the current front-end environment. isavailable() Details The manipulate package works only within the RStudio front-end. TRUE if manipulate is available, otherwise FALSE. manipulate Create an interactive plot The manipulate function accepts a plotting expression and a set of controls (e.g. slider, picker, checkbox, or button) which are used to dynamically change values within the expression. When a value is changed using its corresponding control the expression is automatically re-executed and the plot is redrawn. _expr,...) Arguments _expr Expression to evalulate. The expression should result in the creation of a plot (e.g. plot or qplot). Note that the expression need not be a top-level plotting function, it could also be a custom function that creates a plot as part of its implementation. This expression will be re-evaluated with appropriate parameter substitution each time one of the manipulator control values is changed.... One or more named control arguments (i.e. slider, picker, checkbox, or button), or a list containing named controls.

6 manipulate Details Once a set of manipulator controls are attached to a plot they remain attached and can be recalled whenever viewing the plot (a gear button is added to the top-left of the plot to indicate that it has a manipulator). The _expr argument is evaluated using withvisible. If it s return value is visible then print is called. This enables manipulate expressions to behave simillarly to their being executed directly at the console. The _expr argument uses a syntactially invalid (but backtick quoted) name to avoid clashes with named control arguments. The manipulatorsetstate and manipulatorgetstate functions can be used to associate custom state with a manipulator (for example, to track the values used for previous plot executions). These values are stored in a custom environment which is stored along with the rest of the manipulator context. ## Create a plot with a manipulator plot(1:x), x = slider(5, 10)) ## Using more than one slider plot(cars, xlim=c(x.min,x.max)), x.min=slider(0,15), x.max=slider(15,30)) ## Filtering data with a picker barplot(as.matrix(longley[,factor]), beside = TRUE, main = factor), factor = picker("gnp", "Unemployed", "Employed")) ## Create a picker with labels plot(pressure, type = type), type = picker("points" = "p", "line" = "l", "step" = "s")) ## Toggle boxplot outlier display using checkbox boxplot(freq ~ Class, data = Titanic, outline = outline), outline = checkbox(false, "Show outliers")) ## Combining controls plot(cars, xlim = c(x.min, x.max), type = type, axes = axes, ann = label), x.min = slider(0,15), x.max = slider(15,30, initial = 25), type = picker("p", "l", "b", "c", "o", "h", "s", "S", "n"),

Manipulator Custom State 7 axes = checkbox(true, "Draw Axes"), label = checkbox(false, "Draw Labels")) Manipulator Custom State Modify manipulator state These functions allow the storage of custom state variables across multiple evaluations of manipulator expressions. These functions are useful if the manipulate expression is a custom function (rather than a high level plotting function like plot) which requires reading and writing of persistent values. manipulatorsetstate(name, value) manipulatorgetstate(name) Arguments name value A chraracter string holding a state variable name. An object holding a state value. manipulatorgetstate returns a custom state value which was previously set by manipulatorsetstate (or NULL if the specified name is not found). See Also manipulate ## set custom state variable manipulatorsetstate("last", x) ## get custom state variable last <- manipulatorgetstate("last") if (!is.null(last) ) { # do something interesting }

8 picker manipulatormouseclick Receive notification of mouse clicks on a manipulator plot Details This function can be called to determine if a mouse click on the plot was what caused the current invocation of the manipulate expression, and to determine the coordinates which were clicked. manipulatormouseclick() If a mouse click did occur, then the function returns a list with the coordinates which the user clicked on. If a mouse click did not cause the current invocation of the manipulate expression (e.g. if it was caused by the user changing the value of a control) then the function returns NULL. The mouse click coordinates are provided in device, user, and ndc coordinates. To convert these coordinates into other coordinate systems (e.g. cm or npc) you can use the grconvertx and grconverty functions. Note that the userx and usery coordinates are only applicable for base graphics plots (they are not applicable for grid, lattice, ggplot, etc). Therefore, for non-base graphics the userx and usery values will not contain valid coordinates. Returns a list containing the coordinates that user clicked (or NULL if a mouse click didn t occur): devicex devicey userx usery ndcx ndcy Device X coordinate (expressed in pixels) Device Y coordinate (expressed in pixels) User X coordinate (expressed in plot x units). Note that this value is only valid for base graphics. User Y coordinate (expressed in plot y units). Note that this value is only valid for base graphics. NDC X coordinate (0 to 1 from left to right) NDC Y coordinate (0 to 1 from bottom to top) See Also manipulate, grconvertx, grconverty picker Create a picker control

picker 9 Create a picker control to enable manipulation of plot variables based on a set of fixed choices. picker(..., initial = NULL, label = NULL) Arguments... Arguments containing objects to be presented as choices for the picker (or a list containing the choices). If an element is named then the name is used to display it within the picker. If an element is not named then it is displayed within the picker using as.character. initial label Initial value for picker. must be present in the list of choices specified. If not specified defaults to the first choice. Display label for picker. Defaults to the variable name if not specified. An object of class "manipulator.picker" which can be passed to the manipulate function. See Also manipulate, slider, checkbox, button ## Filtering data with a picker barplot(as.matrix(longley[,factor]), beside = TRUE, main = factor), factor = picker("gnp", "Unemployed", "Employed")) ## Create a picker with labels plot(pressure, type = type), type = picker("points" = "p", "line" = "l", "step" = "s")) ## Picker with groups barplot(as.matrix(mtcars[group,"mpg"]), beside=true), group = picker("group 1" = 1:11, "Group 2" = 12:22, "Group 3" = 23:32)) ## Histogram w/ picker to select type require(lattice) require(stats)

10 slider histogram(~ height voice.part, data = singer, type = type), type = picker("percent", "count", "density")) slider Create a slider control Create a slider control to allow manipulation of a plot variable along a numeric range. slider(min, max, initial = min, label = NULL, step = NULL, ticks = TRUE) Arguments min max initial label step ticks Minimum value for slider. Maximum value for slider. Initial value for slider. Defaults to min if not specified. Display label for slider. Defaults to the variable name if not specified. Step value for slider. If not specified then defaults to 1 for integer ranges and single pixel granularity for floating point ranges (max - min divided by the number of pixels in the slider). Show tick marks on the slider. Note that if the granularity of the step value is very low (more than 25 ticks would be shown) then ticks are automatically turned off. An object of class "manipulator.slider" which can be passed to the manipulate function. See Also manipulate, picker, checkbox, button

slider 11 ## Create a plot with a slider plot(1:x), x = slider(5, 10)) ## Use multiple sliders plot(cars, xlim = c(x.min, x.max)), x.min = slider(0,15), x.max = slider(15,30)) ## Specify a custom initial value for a slider barplot(1:x), x = slider(5, 25, initial = 10)) ## Specify a custom label for a slider barplot(1:x), x = slider(5, 25, label = "Limit")) ## Specify a step value for a slider barplot(1:x), x = slider(5, 25, step = 5))

Index Topic dynamic manipulate-package, 2 Topic iplot manipulate-package, 2 Topic package manipulate-package, 2 as.character, 9 button, 2, 3, 4, 5, 9, 10 checkbox, 2, 3, 4, 5, 9, 10 grconvertx, 8 grconverty, 8 isavailable, 5 manipulate, 2 5, 5, 7 10 manipulate-package, 2 Manipulator Custom State, 7 manipulatorgetstate, 6 manipulatorgetstate (Manipulator Custom State), 7 manipulatormouseclick, 8 manipulatorsetstate, 6 manipulatorsetstate (Manipulator Custom State), 7 picker, 2 5, 8, 10 plot, 7 print, 6 slider, 2 5, 9, 10 withvisible, 6 12