R: Create a button control

button {manipulate} | R Documentation

## 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

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

[Package manipulate version 1.0.1 Index]