picker: Create a picker control

Description Usage Arguments Value See Also Examples

View source: R/manipulate.R

Description

Create a picker control to enable manipulation of plot variables based on a set of fixed choices.

Usage

1
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

Initial value for picker. Value must be present in the list of choices specified. If not specified defaults to the first choice.

label

Display label for picker. Defaults to the variable name if not specified.

Value

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

See Also

manipulate, slider, checkbox, button

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Not run: 

## Filtering data with a picker
manipulate(
  barplot(as.matrix(longley[,factor]),
          beside = TRUE, main = factor),
  factor = picker("GNP", "Unemployed", "Employed"))

## Create a picker with labels
manipulate(
  plot(pressure, type = type),
  type = picker("points" = "p", "line" = "l", "step" = "s"))

## Picker with groups
manipulate(
  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)
manipulate(
  histogram(~ height | voice.part,
            data = singer, type = type),
  type = picker("percent", "count", "density"))


## End(Not run)

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