マックブックな日々(Macbook Geek)

Retina Macbook Proで行った設定、アプリのインストール、トラブル対策等の覚書

Shinyのスライダーを使う

参考:Tutorial: Building 'Shiny' Applications with R
Shinyのスライダーは、チュートリアルのexample05に使い方がまとめられている。

1)sliderInput("変数名","表示名",min=最小値, max=最大値, value=初期値)

sliderInput("integer", "Integer:", 
                min=0, max=1000, value=500),

2)sliderInput("変数名","表示名",min=最小値, max=最大値, value=初期値, step=刻み幅)

    # Decimal interval with step value
    sliderInput("decimal", "Decimal:", 
                min = 0, max = 1, value = 0.5, step= 0.1),

3)sliderInput("変数名","表示名",min=最小値, max=最大値, value=c(領域下端、領域上端))

    # Specification of range within an interval
    sliderInput("range", "Range:",
                min = 1, max = 1000, value = c(200,500)),

4)sliderInput("変数名","表示名",min=最小値, max=最大値, value=初期値, step=刻み幅,
format=書式, locale=, animate=TRUE/FALSE)

    # Provide a custom currency format for value display, with basic animation
    sliderInput("format", "Custom Format:", 
                min = 0, max = 10000, value = 0, step = 2500,
                format="$#,##0", locale="us", animate=TRUE),

5)sliderInput("変数名","表示名",最小値, 最大値, 初期値, step=刻み幅,
animate=animationOptions(interval=インターバル, loop=T/F))

    # Animation with custom interval (in ms) to control speed, plus looping
    sliderInput("animation", "Looping Animation:", 1, 2000, 1, step = 10, 
                animate=animationOptions(interval=300, loop=T))