我正在使用 RStudio 版本 0.98.507。关于初始工作工具的简短信息:
R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
other attached packages:
[1] shinyapps_0.3.53 RJSONIO_1.2-0.2 shiny_0.9.1.9013
loaded via a namespace (and not attached):
[1] bitops_1.0-6 Cairo_1.5-5 caTools_1.17 digest_0.6.4
[5] htmltools_0.2.4 httpuv_1.3.0 Rcpp_0.11.1 RCurl_1.95-4.1
[9] shinysky_0.1.2 tools_3.1.0 xtable_1.7-3
我在闪亮的服务器上部署闪亮的应用程序时遇到了问题。问题在某个时候得到了解决,但在它再次出现之后。现在我不能再修复它了。我的问题是helpers.R中的德语字母。不幸的是,我无法避免使用它们。我正在将我的帮助脚本helpers.R采购到server.R中,就像在 Shiny Tutorial 中显示和教授的那样。我所有的 R 脚本都小心地保存在 UTF-8 格式下。我无法使用命令
options(encoding="UTF-8")
因为执行后,命令 deployApp("app") 不起作用。我使用设置位置
Sys.setlocale(category = "LC_ALL", locale = "German")
它也不起作用。我不明白,为什么mainPanel和sidebarLayout中的字母是可读的,但来自helpers.R的字母却不是。有人可以帮我解决这个悖论吗?
例子
用户界面
library(shiny)
shinyUI(fluidPage(withMathJax(),
titlePanel("Währung"),
sidebarLayout(position="right",
sidebarPanel(
h5("Bedienfenster"),
sliderInput('x', 'x axis',
value=50, min=3, max=150, step=1,)
),
mainPanel(
plotOutput("Plot")
)
)
))
服务器.R
shinyServer(function(input, output){
output$Plot <- renderPlot({
x <- rnorm(input$x)
hist(x, main="", xlab="", ylab="")
title(main="Schätzgerade", xlab="Währung", ylab="Dichte")
})
})
部署后我得到以下应用程序。