mwSlider: Add a Slider to a manipulateWidget gadget

Description Usage Arguments Value See Also Examples

View source: R/inputs.R

Description

Add a Slider to a manipulateWidget gadget

Usage

1
mwSlider(min, max, value, label = NULL, ..., .display = TRUE)

Arguments

min

The minimum value that can be selected.

max

The maximum value that can be selected.

value

Initial value of the slider A numeric vector of length one will create a regular slider; a numeric vector of length two will create a double-ended range slider

label

Display label for the control. If NULL, the name of the corresponding variable is used.

...

Other arguments passed to functionsliderInput

.display

expression that evaluates to TRUE or FALSE, indicating when the input control should be shown/hidden.

Value

A function that will generate the input control.

See Also

Other controls: mwCheckboxGroup(), mwCheckbox(), mwDateRange(), mwDate(), mwGroup(), mwNumeric(), mwPassword(), mwRadio(), mwSelectize(), mwSelect(), mwSharedValue(), mwText()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
if (require(plotly)) {

  myWidget <- manipulateWidget(
    plot_ly(data.frame(x = 1:n, y = rnorm(n)), x=~x, y=~y, type = "scatter", mode = "markers"),
    n = mwSlider(1, 100, 10, label = "Number of values")
  )

  Sys.sleep(0.5)

  # Create a double ended slider to choose a range instead of a single value
  mydata <- data.frame(x = 1:100, y = rnorm(100))

  manipulateWidget(
    plot_ly(mydata[n[1]:n[2], ], x=~x, y=~y, type = "scatter", mode = "markers"),
    n = mwSlider(1, 100, c(1, 10), label = "Number of values")
  )

}

manipulateWidget documentation built on Oct. 5, 2021, 9:10 a.m.