私のShinyアプリケーションのユーザーは、行と列の名前を持つ2x2テーブルの値を入力してもらいたいです。もちろん、私は4つの入力ボックスでそれを行うことができますが、すべてをきれいに配置するのは難しいと思います。それにもかかわらず、私はDT
パッケージによって提供されるようなテーブルレイアウトを好むでしょう。したがって、私の質問です:datatable
(または類似のもの)をユーザーが埋め込むことは可能ですか?テーブルをシャイニーに入れる方法は?
1
A
答えて
1
DT
と解決策:
library(DT)
library(shiny)
dat <- data.frame(
V1 = c(as.character(numericInput("x11", "", 0)), as.character(numericInput("x21", "", 0))),
V2 = c(as.character(numericInput("x21", "", 0)), as.character(numericInput("x22", "", 0)))
)
ui <- fluidPage(
fluidRow(
column(5, DT::dataTableOutput('my_table')),
column(2),
column(5, verbatimTextOutput("test"))
)
)
server <- function(input, output, session) {
output$my_table <- DT::renderDataTable(
dat, selection = "none",
options = list(searching = FALSE, paging=FALSE, ordering=FALSE, dom="t"),
server = FALSE, escape = FALSE, rownames= FALSE, colnames=c("", ""),
callback = JS("table.rows().every(function(i, tab, row) {
var $this = $(this.node());
$this.attr('id', this.data()[0]);
$this.addClass('shiny-input-container');
});
Shiny.unbindAll(table.table().node());
Shiny.bindAll(table.table().node());")
)
output$test <- renderText({
as.character(input$x11)
})
}
shinyApp(ui, server)
2
あなたがやりたいshinysky
devtools::install_github("AnalytixWare/ShinySky")
パッケージ
またはrhandsontable
使用することができます。
rm(list = ls())
library(shiny)
library(shinysky)
server <- shinyServer(function(input, output, session) {
# Initiate your table
previous <- reactive({mtcars[1:10,]})
MyChanges <- reactive({
if(is.null(input$hotable1)){return(previous())}
else if(!identical(previous(),input$hotable1)){
# hot.to.df function will convert your updated table into the dataframe
as.data.frame(hot.to.df(input$hotable1))
}
})
output$hotable1 <- renderHotable({MyChanges()}, readOnly = F)
output$tbl = DT::renderDataTable(MyChanges())
})
ui <- basicPage(mainPanel(column(6,hotable("hotable1")),column(6,DT::dataTableOutput('tbl'))))
shinyApp(ui, server)
関連する問題
- 1. テーブルに入れる方法
- 2. Rシャイニー・コンティンジェンシー・テーブル
- 3. シャイニーにボタンを配置する方法
- 4. シャイニー - シャイニーのボーダーセルテーブルを着色する方法
- 5. シャイニー:テーブルに変数を選択
- 6. シャイニー:ユーザー入力データの場所に基づいてデータをフィルタリングする方法
- 7. happybaseを通じてhbaseテーブルに値を入れる方法は?
- 8. シャイニーで条件パネルを非表示にする方法は?
- 9. ダイヤモンドパターン/シェイプ(アスタリスク)をテーブルの中に入れる方法は? (html + php)
- 10. JSONデータをHTMLテーブルに入れる方法は?
- 11. mathematicaのテーブルや配列に結果を入れる方法は?
- 12. 配列の各要素をテーブルの行 - テーブルのデータに入れる方法は?
- 13. テーブルにデータを挿入する方法
- 14. テーブルがmainPanelのタブに表示されていません - シャイニー
- 15. はシャイニー
- 16. シャイニー - 入力に基づいてフィルタリングされたデータで静的なHTMLテーブルを作成する
- 17. CSSテーブルの間にスペースを入れる方法(応答ウェブページ)
- 18. SQLデータをHTMLテーブルに入れる方法
- 19. 2つのテーブルの真中に線を入れる方法
- 20. PHP - 私のフォーラムをテーブルの列に入れる方法
- 21. テーブル内で繰り返さずに値を入れる方法
- 22. Rのシャイニー:ボタンをクリックして入力値をNULLに設定する方法は?
- 23. シャイニー:ダウンロード・テーブル・データおよびプロット
- 24. リーフレットの入力をシャイニーで選択
- 25. 式シャイニーUIの数値を入力
- 26. パネルに挿入できるテーブルを生成する方法は?
- 27. Rシャイニー:ラジオボタンを他の入力に影響を与える
- 28. Pythonを使ってDynamoDBテーブルに項目を入れる方法は?
- 29. MySQL - 複数のテーブルをクエリして結果をxlsに入れる方法は?
- 30. 列の説明をAccessテーブルに挿入する方法は?
'shinysky'パッケージはどこにありますか? 'install.packages(" shinysky ")'はそれが見つからないと言っています。 – Joe
'devtools :: install_github(" AnalytixWare/ShinySky ")' –