path - 规范化路径 R Shiny 错误

标签 path shiny rstudio normalize shinydashboard

这是我关于堆栈溢出的第一个问题,所以如果我提出一个相当模糊或困难的问题,我提前道歉。

我一直致力于开发一个小型 Web 应用程序,该应用程序使用 Rfacebook 包从 Facebook 页面中提取粒度数据。我已经完成了这个网络应用程序的数据提取功能,现在开始使用 shinydashboard 开发 Shiny 的 UI 和服务器功能。

我已经完成了仪表板开发的一个阶段,并且已经成功地对其进行了多次测试,但是一旦我关闭并保存 RStudio 然后重新启动它,每当我尝试 runApp 时,我都会不断收到此错误。

Warning: Error in normalizePath: path[1]="C:\Users\Adel\AppData\Local\Temp\RtmpIr7Hkl\widgetbinding16a456f01dfa": The system cannot find the file specified Stack trace (innermost first): 1: shiny::runApp Error in normalizePath(path.expand(path), winslash, mustWork) : path[1]="C:\Users\Adel\AppData\Local\Temp\RtmpIr7Hkl\widgetbinding16a456f01dfa": The system cannot find the file specified

我尝试删除并重新安装所有相关包,但失败了。 我还尝试在指定路径中创建一个文件“widgetbinding16a456f01dfa”,它导致呈现 shinydashboard,但它是非功能性仪表板。 此外,我尝试在 RStudio 上更改项目,shinydashboard 工作,但是每当我关闭并重新启动 RStudio 时,我都会收到相同的错误,但文件名略有不同(即 widgetbinding[..different numbers])

关于此错误的在线信息有限,我有预感这是一个 RStudio 错误,而不是一个 Shiny 的错误。

下面是我用于 ui.r 的代码

library(shiny)
library(shinydashboard)
library(shinythemes)
library(DT)
library(Rfacebook)

header <- dashboardHeader()

sidebar <- dashboardSidebar(
  sidebarMenu(

    textInput("f_id", "Enter Facebook Page ID", value = "Enter ID ..."),
    dateRangeInput('dateRange',
                   label = 'Input Date',
                   start = Sys.Date() - 2, end = Sys.Date() + 2),
    actionButton("go", "Go")
  )
)


body <- dashboardBody(
  fluidRow(
    dashboardBody(
      dataTableOutput("table1",height = 5, width = "20") 
    )  
)     )

shinyUI(
  dashboardPage(header,sidebar,body))

下面是我为服务器写的代码.R

shinyServer(function(input,output){

  table <- eventReactive(input$go, {
    facebook_analyzer(input$f_id, since = format(input$dateRange[1])
                      , until = format(input$dateRange[2]))
})  

  output$table1 <-  renderDataTable(
     datatable((table()[,c("poster_name","poster_id","post_content","date_of_post")]), 
               options = list(pageLength = 5, deferRender = TRUE )))
  }) 

任何帮助将不胜感激,我已经尝试调试此错误两天了。谢谢!

最佳答案

我试图重现错误。我创建了一个文件夹 app 并将两个文件复制到其中;一切运行良好。因此,软件包的更高版本 可能会解决这个问题(自提出这个问题以来已经过去了四年多)。此外,我会确保文件 server.Rui.R 位于同一文件夹中,并且工作目录设置为 app 文件夹(这也不应该没有必要)。

以下可能不适用于上述问题,因为它发生在 library(gfonts)setup_font(id = "roboto",output_dir = "www", variants = "regular"),但错误信息类似:

Error in normalizePath(path.expand(path), winslash, mustWork) : path[1]="www": The system cannot find the file specified

就我而言,我创建了文件夹 (www),这解决了问题。

一般情况下,如果目录不存在,normalizePath('myFolder') 命令会返回上述信息。

因为,原始问题包含一条路径。需要检查路径(和文件)是否存在。如果存在,则必须检查访问权限。如果它不存在,则需要识别创建它的库 (...widgetbinding... >> htmlwidgets),并检查新版本是否解决了该问题,或其他一些解决方法(例如更短的路径、不同的文件夹...)。

关于path - 规范化路径 R Shiny 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37341150/

相关文章:

R Shiny 错误: Problems with a reactive function

windows - 使用 .bat 打开文件夹

r - Shiny + DT : Single Cell Selection

r - 禁止在选项卡之间行走 Shiny

r - 如何显示一组与特定颜色相似的颜色?

r - 如何在 Windows 10 上的 R 中安装 stringi 包?

C open() 为路径字符串返回 -1

java - 访问 Maven 项目中的属性文件

Python os.makedirs 重新创建路径

r - 定义 rstudio 中的代码部分