Learn R Programming

manipulate (version 1.0.1)

button: Create a button control

Description

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).

Usage

button(label)

Arguments

label
Label for button.

Value

An object of class "manipulator.button" which can be passed to the manipulate function.

See Also

manipulate, slider, picker, checkbox

Examples

Run this code
## Not run: 
# 
# ## use a button to reset a random seed
# manipulate(
#   {
#     if(resetSeed)
#       set.seed(sample(1:1000))
# 
#     hist(rnorm(n=100, mean=0, sd=3), breaks=bins)
#   },
#   bins = slider(1, 20, step=1, initial =5, label="Bins"),
#   resetSeed = button("Reset Seed")
# )
# 
# ## End(Not run)

Run the code above in your browser using DataLab