0
私はテキストファイルを生成するアプリを持っています。私は\n
を使ってテキストを改行する。アプリケーションをローカルで実行すると、ダウンロードしたtxtファイルの出力が正しくなります。しかし、Shiny Serverでアプリを実行すると、テキストは新しい行に印刷されません。つまり、\n
は動作していないようです。ここでは例のアプリがある:ここではShiny Serverから新しい行( n)でテキストファイルを書き込む
ui <- fluidPage(title = "",
sidebarLayout(
sidebarPanel(
numericInput("num", "Number of lines to paste", 3),
actionButton("gen", "Generate text with new lines"),
downloadButton("downloadWeld", "Download")
),
mainPanel(
verbatimTextOutput("vtxt")
))
)
server <- function(input, output) {
values <- reactiveValues()
values$df <- c()
observeEvent(input$gen,{
values$df <- NULL
values$df <- paste0("E",input$num,"\n")
for(i in 1:input$num)
values$df <- paste0(values$df, "hello\n",i,"\nworld\n")
})
output$vtxt <- renderText({
values$df
})
output$downloadWeld <- downloadHandler(
filename <- function() {
paste0(input$num,"fname.txt")
},
content <- function(file) {
writeLines(values$df, file)
},
contentType = "text/csv"
)
}
shinyApp(ui = ui, server = server)
は、地元のための私のSessionInfoです:
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_2.2.1 shiny_1.0.2
loaded via a namespace (and not attached):
[1] Rcpp_0.12.7 assertthat_0.1 digest_0.6.10 mime_0.5
[5] grid_3.3.1 R6_2.1.2 plyr_1.8.4 xtable_1.8-2
[9] jsonlite_1.0 gtable_0.2.0 scales_0.4.1 lazyeval_0.2.0
[13] labeling_0.3 tools_3.3.1 munsell_0.4.3 httpuv_1.3.3
[17] colorspace_1.2-6 htmltools_0.3.5 tibble_1.2
とサーバー:
R version 3.3.3 (2017-03-06)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8
[4] LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] pool_0.1.0 data.table_1.9.6 sqldf_0.4-10 RSQLite_1.0.0
[5] gsubfn_0.6-6 proto_0.3-10 RMySQL_0.10.9 DBI_0.5-1
[9] dplyr_0.5.0 ggthemes_2.2.1 scales_0.4.1 plyr_1.8.4
[13] shinydashboard_0.5.1 shinythemes_1.1.1 markdown_0.7.7 shiny_1.0.2
[17] ggplot2_2.2.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.8 magrittr_1.5 munsell_0.4.3 colorspace_1.3-2 xtable_1.8-0 R6_2.2.0
[7] tcltk_3.3.3 tools_3.3.3 grid_3.3.3 gtable_0.2.0 htmltools_0.3.5 lazyeval_0.2.0
[13] assertthat_0.1 digest_0.6.11 tibble_1.2 mime_0.4 labeling_0.3 jsonlite_1.1
[19] chron_2.3-47 httpuv_1.3.3
すべてのアイデアは、私が正しい出力を得ることができない理由サーバーアプリ?