r - setwd(bundleDir) 错误 : cannot change working directory

标签 r shiny openair

我可以开发需要其他软件包的 R Shiny 应用程序吗?例如,

ui.R,

shinyServer(
  pageWithSidebar(
    headerPanel("Shiny App"),

    sidebarPanel("side bar"),

    mainPanel(
      plotOutput("myPlot")
      )

    )

)

服务器.R,

shinyServer(

  function(input, output, session) {

    output$myPlot = renderPlot({

      library("openair")
      scatterPlot(selectByDate(mydata, year = 2003), x = "nox", y = "no2",
                  method = "density", col = "jet")
    })
  }

)

运行应用程序,

> runApp()

Listening on http://127.0.0.1:4459
Loading required package: lazyeval
Loading required package: dplyr

Attaching package: ‘dplyr’

The following object is masked from ‘package:stats’:

    filter

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

Loading required package: maps
(loaded the KernSmooth namespace)

我在本地机器上得到这个结果,

enter image description here

但是当我尝试部署应用程序时,我在下面遇到了这个错误,

> setwd("C:/.../myapp")
> library(shiny)
> library(shinyapps)

Attaching package: ‘shinyapps’

The following object is masked from ‘package:shiny’:

    hr

> deployApp()
Preparing to deploy application...DONE
Uploading application bundle...
Error in setwd(bundleDir) : cannot change working directory

这是怎么回事?这是否意味着我无法将 native R 与其他包(例如 openair)集成/导入?

编辑:

> require(openair)
> deployApp()

Uploading application bundle...
Error in setwd(bundleDir) : cannot change working directory

最佳答案

您不能在部署的应用程序中使用带有绝对路径的 setwd(),因为您不再在您的计算机上,而是在不同的服务器上。您只能将 setwd() 与您的应用程序文件夹的相对路径一起使用。

关于r - setwd(bundleDir) 错误 : cannot change working directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29794075/

相关文章:

r - 使用 'openair'包绘制风向玫瑰图时字体变大?

javascript - RStudio Shiny 和 JavaScript 通信问题

r - 使用 R 进行 PCA 特征选择

R - 图像绘图 MNIST 数据集错误 'z' 必须是矩阵

r - 在 tidyverse 中每隔一行填充上一层

r - 通过 Shiny 在布局之间进行响应式(Reactive)切换

r - 在 R 中的 Shiny 应用程序中动态绘制 Plotly 图形

r - R-找不到-llapack和找不到-lblas

html - 解析xml属性: strange Encoding issue