button: Create a button control

Description Usage Arguments Value See Also Examples

View source: R/manipulate.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## 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)

manipulate documentation built on May 2, 2019, 3:27 a.m.