manipulate: Manipulate command ala RStudio (with added animation...

Description Usage Arguments Value Examples

Description

Due to the event loop structure of tcltk, this only works in the GTK toolkit at the moment.

Usage

1
manipulate(._expr, ...)

Arguments

._expr

expression to produce output.

...

used to specify controls. See picker, checkbox, slider.

Value

makes output, returns Animanipulate object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
manipulate(## expression
{
  size <- sqrt.size^2
  y <- get(distribution)(size)
  plot(density(y, bw = bandwidth/100, kernel=kernel),
       axes = axes, ann = label,
       main = paste("kernel:", kernel))
  points(y, rep(0, size))
},
## controls
distribution = picker("rnorm", "rexp"),
kernel = picker("gaussian", "epanechnikov",
                "rectangular", "triangular", "cosine"),
sqrt.size = slider(5, 30, step = 1, init = 10),
bandwidth = slider(5, 200, step = 5, init = 100,
                   label = "bandwith [%]"), # using % here b/c some toolkits only allow integers (GTK is fine with real)
axes = checkbox(TRUE, label="Draw Axes"),
label = checkbox(TRUE, label="Draw Labels")
)

## End(Not run)

sebkopf/animanipulate documentation built on May 29, 2019, 4:58 p.m.