找不到功能" getSymbols"使用ShinyApps.io时

时间:2014-11-30 05:18:20

标签: r shiny quantmod

我刚刚在Rstudio中完成了一个交易策略,我计划将其部署在ShinyApps.io上。这有一个问题。

首先,总会有一条警告信息:

Warning messages:
1: In getFromNamespace("checkEncoding", "shiny")(file) :
  The file "F:\newFinal/server.R" is not encoded in UTF-8. Please convert its encoding to UTF-8 (e.g. use the menu `File -> Save with Encoding` in RStudio). See http://shiny.rstudio.com/articles/unicode.html for more info. Falling back to the encoding "native.enc".
2: In getFromNamespace("checkEncoding", "shiny")(file) :
  The file "F:\newFinal/server.R" is not encoded in UTF-8. Please convert its encoding to UTF-8 (e.g. use the menu `File -> Save with Encoding` in RStudio). See http://shiny.rstudio.com/articles/unicode.html for more info. Falling back to the encoding "native.enc".

即使我使用UTF-8编码保存文件,每次部署应用程序时它仍会显示警告。

另一件事是我无法在ShinyApps中获取其他文件,如下所示:

source("helpers.R")
#source("loadfunction.R")
source("main2.R")
#source("main.R")
source("plotperiod.R")

以下日志显示系统找不到“getSymbols”函数。

2014-11-30T05:01:21.252572+00:00 shinyapps[shuttle]: rmarkdown version: 0.0.0
2014-11-30T05:01:21.251463+00:00 shinyapps[shuttle]: Shiny version: 0.10.2.1
2014-11-30T05:01:21.253004+00:00 shinyapps[shuttle]: knitr version: 0.0.0
2014-11-30T05:01:21.517405+00:00 shinyapps[shuttle]: 
2014-11-30T05:01:21.517408+00:00 shinyapps[shuttle]: Starting Shiny with process ID: '25'
2014-11-30T05:01:21.524432+00:00 shinyapps[shuttle]: 
2014-11-30T05:01:21.524434+00:00 shinyapps[shuttle]: Listening on http://0.0.0.0:35292
2014-11-30T05:01:22.543644+00:00 shinyapps[shuttle]: Error in eval(expr, envir, enclos) : could not find function "getSymbols"
2014-11-30T05:08:22.837418+00:00 shinyapps[shuttle]: R version: 3.1.1
2014-11-30T05:08:22.838692+00:00 shinyapps[shuttle]: rmarkdown version: 0.0.0
2014-11-30T05:08:22.837469+00:00 shinyapps[shuttle]: Shiny version: 0.10.2.1
2014-11-30T05:08:22.839117+00:00 shinyapps[shuttle]: knitr version: 0.0.0
2014-11-30T05:08:23.115849+00:00 shinyapps[shuttle]: 
2014-11-30T05:08:23.115852+00:00 shinyapps[shuttle]: Starting Shiny with process ID: '12'
2014-11-30T05:08:23.122818+00:00 shinyapps[shuttle]: 
2014-11-30T05:08:23.122821+00:00 shinyapps[shuttle]: Listening on http://0.0.0.0:56837
2014-11-30T05:08:31.778390+00:00 shinyapps[shuttle]: Shiny version: 0.10.2.1
2014-11-30T05:08:31.779947+00:00 shinyapps[shuttle]: knitr version: 0.0.0
2014-11-30T05:08:31.778335+00:00 shinyapps[shuttle]: R version: 3.1.1
2014-11-30T05:08:31.779528+00:00 shinyapps[shuttle]: rmarkdown version: 0.0.0
2014-11-30T05:08:32.080184+00:00 shinyapps[shuttle]: 
2014-11-30T05:08:32.080190+00:00 shinyapps[shuttle]: Starting Shiny with process ID: '25'
2014-11-30T05:08:32.087453+00:00 shinyapps[shuttle]: 
2014-11-30T05:08:32.087455+00:00 shinyapps[shuttle]: Listening on http://0.0.0.0:55221
2014-11-30T05:08:33.083355+00:00 shinyapps[shuttle]: Error in eval(expr, envir, enclos) : could not find function "getSymbols"
2014-11-30T05:11:27.282921+00:00 shinyapps[shuttle]: Shiny version: 0.10.2.1
2014-11-30T05:11:27.284559+00:00 shinyapps[shuttle]: knitr version: 0.0.0
2014-11-30T05:11:27.282870+00:00 shinyapps[shuttle]: R version: 3.1.1
2014-11-30T05:11:27.284140+00:00 shinyapps[shuttle]: rmarkdown version: 0.0.0
2014-11-30T05:11:27.554872+00:00 shinyapps[shuttle]: 
2014-11-30T05:11:27.554875+00:00 shinyapps[shuttle]: Starting Shiny with process ID: '12'
2014-11-30T05:11:27.561737+00:00 shinyapps[shuttle]: 
2014-11-30T05:11:27.561740+00:00 shinyapps[shuttle]: Listening on http://0.0.0.0:33719
2014-11-30T05:11:34.514578+00:00 shinyapps[shuttle]: Shiny version: 0.10.2.1
2014-11-30T05:11:34.516275+00:00 shinyapps[shuttle]: knitr version: 0.0.0
2014-11-30T05:11:34.514528+00:00 shinyapps[shuttle]: R version: 3.1.1
2014-11-30T05:11:34.515806+00:00 shinyapps[shuttle]: rmarkdown version: 0.0.0
2014-11-30T05:11:34.784230+00:00 shinyapps[shuttle]: 
2014-11-30T05:11:34.784232+00:00 shinyapps[shuttle]: Starting Shiny with process ID: '25'
2014-11-30T05:11:34.791157+00:00 shinyapps[shuttle]: 
2014-11-30T05:11:34.791160+00:00 shinyapps[shuttle]: Listening on http://0.0.0.0:47994
2014-11-30T05:11:36.003478+00:00 shinyapps[shuttle]: Error in eval(expr, envir, enclos) : could not find function "getSymbols"
2014-11-30T05:12:10.176603+00:00 shinyapps[shuttle]: R version: 3.1.1
2014-11-30T05:12:10.177833+00:00 shinyapps[shuttle]: rmarkdown version: 0.0.0
2014-11-30T05:12:10.176681+00:00 shinyapps[shuttle]: Shiny version: 0.10.2.1
2014-11-30T05:12:10.178237+00:00 shinyapps[shuttle]: knitr version: 0.0.0
2014-11-30T05:12:10.483932+00:00 shinyapps[shuttle]: 
2014-11-30T05:12:10.483938+00:00 shinyapps[shuttle]: Starting Shiny with process ID: '33'
2014-11-30T05:12:10.491297+00:00 shinyapps[shuttle]: 
2014-11-30T05:12:10.491300+00:00 shinyapps[shuttle]: Listening on http://0.0.0.0:35973
2014-11-30T05:12:11.486962+00:00 shinyapps[shuttle]: Error in eval(expr, envir, enclos) : could not find function "getSymbols"

1 个答案:

答案 0 :(得分:0)

不确定这是否可以解决问题但是为了获取文件,您需要添加local参数并将其设置为TRUE,如下所示:

source("helpers.R", local=TRUE)
source("main2.R", local=TRUE)
source("plotperiod.R", local=TRUE)