dashR
v0.9.3
ドキュメント|ギャラリー
https://dash.plotly.com/r/installation
? Rのバージョン
3.0.2に少なくともバージョン3.0.2にいることを確認してください。RCLIにversionを入力することで、Rのバージョンを確認できます。 CRANは、最新のRバージョンをダウンロードするのが最も簡単な場所です。
2020-06-04の時点で、 Dashと現在リリースされたすべてのコアコンポーネントライブラリのバージョンは、CRAN経由でダウンロードできます! dashとその依存関係をインストールすることは簡単です
install.packages( " dash " )パッケージの(安定した)開発バージョンとGitHubのダッシュコンポーネントをインストールしたいユーザーは、代わりにinstall_github使用して開発ブランチを指定できます。
install.packages(c( " fiery " , " routr " , " reqres " , " htmltools " , " base64enc " , " plotly " , " mime " , " crayon " , " devtools " ))
# installs dash, which includes dashHtmlComponents, dashCoreComponents, and dashTable
# and will update the component libraries when a new package is released
devtools :: install_github( " plotly/dashR " , ref = " dev " , upgrade = TRUE )次に、パッケージをRにロードするには:
library( dash )それでおしまい!
https://dash.plotly.com/r/layout
RパッケージDASHを使用すると、Rを搭載したリアクティブWebアプリケーションを簡単に作成できます。これは、 new() Dashを介して初期化される可能性のあるR6クラスを提供します。
library( dash )
app <- Dash $ new()PythonのDashとJuliaのDashと同様に、Rアプリケーション用のすべてのDashには、レイアウト(つまり、ユーザーインターフェイス)と、入力値が変更されたときに実行する更新ロジックを定義するコールバック関数のコレクションが必要です。たとえば、文字列のフォーマットのこの基本的な例を考えてみましょう。
library( dash )
dash_app() % > %
set_layout(
dccInput( id = " text " , " sample " ),
div( " CAPS: " , span( id = " out1 " )),
div( " small: " , span( id = " out2 " ))
) % > %
add_callback(
list (
output( " out1 " , " children " ),
output( " out2 " , " children " )
),
input( " text " , " value " ),
function ( text ) {
list (
toupper( text ),
tolower( text )
)
}
) % > %
run_app()ここで、 showcase = TRUE引数はブラウザウィンドウを開き、Dashアプリを自動的にロードします。
dccGraphを使用したHello Worldの例library( dash )
# Create a Dash app
app <- dash_app()
# Set the layout of the app
app % > % set_layout(
h1( ' Hello Dash ' ),
div( " Dash: A web application framework for your data. " ),
dccGraph(
figure = list (
data = list (
list (
x = list ( 1 , 2 , 3 ),
y = list ( 4 , 1 , 2 ),
type = ' bar ' ,
name = ' SF '
),
list (
x = list ( 1 , 2 , 3 ),
y = list ( 2 , 4 , 5 ),
type = ' bar ' ,
name = ' Montr U {00E9}al '
)
),
layout = list ( title = ' Dash Data Visualization ' )
)
)
)
# Run the app
app % > % run_app()