まったく表示されない千単位の区切り記号を除いて、Shiny アプリケーションで完全に表示されている DataTable があります。デフォルトではコンマを使用すると思っていましたが、表示されていない場合は、oLanguage sInfoThousands を使用して指定しようとしました。私の他の oLanguage 仕様 sInfo は機能しているので、3 桁ごとの区切り記号がまったく表示されない理由を突き止めようとしています。これはデータ型の問題のように見えますか、それとも指定方法の問題ですか? 最初の 2 つの列は両方のテーブルの文字列であり、残りは整数 (データフレームでは double) であり、適切に並べ替えられています。
shinyServer(function(input, output, session){
tab1_final<-read.csv("/home/bdk/tracker/tab1_final.csv")
tab2_final<-read.csv("/home/bdk/tracker/tab2_final.csv")
mydata <- reactive({
switch(input$dataset, FY = data.table(tab2_final),
Q = data.table(tab1_final)
)
})
output$mytable <- renderChart2({
dTable(mydata(),
sPaginationType = 'full_numbers',
aLengthMenu = list(c(10, 25, 50, 100, -1),c(10, 25, 50, 100, "All")),
oLanguage = list(sInfo="Showing _START_ to _END_ of _TOTAL_ entries. All numbers shown in US Dollars.",
sInfoThousands=","
)
)
})
})
ご協力ありがとうございます。さらに情報を提供する必要がある場合はお知らせください。(最初の質問が投稿されたので、ルールに違反していたら申し訳ありません!)
編集(mtcars を使用 - mpg を乗算して、桁区切り記号が必要になるようにしました):
#server.R
require(rCharts)
shinyServer(function(input, output, session){
mtcars$mpg<-mtcars$mpg*1000.3
mydata <- reactive({
switch(input$dataset, By_Fiscal_Year = data.table(mtcars),
By_Quarter = data.table(mtcars)
)
})
output$mytable <- renderChart2({
dTable(data.table(mydata()),
sPaginationType = 'full_numbers',
aLengthMenu = list(c(10, 25, 50, 100, -1),c(10, 25, 50, 100, "All")),
oLanguage = list(sInfoThousands=",")
)
})
})
#ui.R
require(shiny)
require(shinyIncubator)
require(rCharts)
options(RCHART_LIB = 'polycharts')
shinyUI(pageWithSidebar(
headerPanel(list('Test DataTables Comma')),
sidebarPanel(
selectInput('dataset', 'Choose Current Quarter or Entire FY',
c('By_Fiscal_Year', 'By_Quarter')
)
),
mainPanel(
tabsetPanel(id ="tab1",
tabPanel("Table", chartOutput("mytable", "datatables"))
)
)
))
カンマを mpg 列に表示するにはどうすればよいですか? それでも数値として並べ替えますか? 画像を投稿する評判はまだありませんが、ここに私が見ているもののスクリーンショットへのリンクがあります (最初の列には千単位の区切り記号がありません):