标准化路径 R 闪亮时出错 [英] Error in normalize path R shiny

查看:1070
本文介绍了标准化路径 R 闪亮时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

This is my first question on stack overflow so I apologize in advance in case I ask a rather vague or difficult question.

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

I have been working on developing a small web app that extracts granular data from facebook pages using the Rfacebook package. I have completed the data extraction function for this web app and have now moved to developing the shiny UI and server functions using shinydashboard.

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

I have completed one phase of the dashboard development, and I had tested it multiple times successfully, however once I closed and saved RStudio and then relaunched it, I kept getting this error whenever I try runApp.

Warning: E​​rror in normalizePath: path[1]="C:\Users\Adel\AppData\Local\Temp\RtmpIr7Hkl\widgetbinding16a456f01dfa": 系统找不到指定的文件堆栈跟踪(最里面在先):1:闪亮::运行应用程序normalizePath(path.expand(path), winslash, mustWork) 中的错误:path[1]="C:\Users\Adel\AppData\Local\Temp\RtmpIr7Hkl\widgetbinding16a456f01dfa": 系统找不到指定的文件

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",它导致呈现闪亮的仪表板,但它是非功能性仪表板.此外,我尝试在 RStudio 上更改项目,shinydashboard 工作,但是每当我关闭并重新启动 RStudio 时,我都会收到相同的错误,但文件名略有不同(即小部件绑定[..不同的数字])

I tried removing and reinstalling all relevant packages, however it was a failure. I have also tried to create a file "widgetbinding16a456f01dfa" in the specified path, it resulted in rendering the shinydashboard, but it was non-functional dashboard. Furthermore, I tried changing projects on RStudio, the shinydashboard worked, however whenever I close and relaunch RStudio I receive the same error but vaguely different filenames (i.e widgetbinding[..different numbers])

网上关于这个错误的信息有限,我有预感这是一个 RStudio 错误而不是一个闪亮的错误.

There has been limited information about this bug online, I have a hunch it's an RStudio error and not a shiny one.

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

Below is the code I used for the 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

Below is the code I wrote for the server.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 )))
  }) 

非常感谢任何帮助,我已经尝试调试此错误两天了.谢谢!

Any help would be extremely appreciated, I have been trying to debug this error for two days. Thank you!

推荐答案

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

I tried to reproduce the error. I created a folder app and copied the two files into it; and it all runs fine. So, a later version of the packages might address this issue (more than four years have passed since this questions was asked). Furthermore, I'd ensure the files server.R and ui.R are in the same folder, and the working directory is set to the app folder (also this shouldn't be necessary).

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

The following might not apply to the stated problem directly, since it occurred in the context of library(gfonts) and setup_font(id = "roboto",output_dir = "www",variants = "regular"), but the error message is similar:

normalizePath(path.expand(path), winslash, mustWork) 中的错误:path[1]="www": 系统找不到指定的文件

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

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

In my case, I created the folder (www) and this resolved the issue.

通常,如果目录不存在,命令normalizePath('myFolder')会返回上述消息.

Generally, the command normalizePath('myFolder') returns the above messages if the directory does not exist.

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

Since, the original question contained a path. One needs to check if the path (and file) exists. If it exists the access rights have to be checked. If it does not exist the library creating it needs to be identified (...widgetbinding... >> htmlwidgets), and checked whether a newer release addresses the issue, or some other work-around (e.g. shorter paths, different folder,...).

这篇关于标准化路径 R 闪亮时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆