2

我正在尝试使用学者包来开发一个闪亮的应用程序。当我在本地运行它时它工作得非常好,但是在部署到 shinyapps.io 时我收到了这个警告(并且代码不起作用):

Warning in get_scholar_resp(url, 5) :
2021-12-04T14:56:08.621126+00:00 shinyapps[5266206]:   194: <Anonymous>
2021-12-04T14:56:08.603929+00:00 shinyapps[5266206]:   Page 404. Please check whether the provided URL is correct.
2021-12-04T14:56:08.610531+00:00 shinyapps[5266206]: Warning: Error in httr::content: is.response(x) is not TRUE

这不是编码问题。我不确定是什么原因造成的,如果有人可以提供帮助,那就太好了。

这是一个可重现的例子:

library(shiny)
library(scholar)
library(dplyr)

ui <- fluidPage(
    titlePanel("Scholar package example"),
    sidebarLayout(
        sidebarPanel(
            textInput(
              'id',
              'Insert scholar id',
              value = 'LBHrWsIAAAAJ'
            ),
            actionButton(
              'search',
              'Plot network'
            )
        ),
        mainPanel(
           plotOutput("network")
        )
    )
)

server <- function(input, output) {
  observeEvent(input$search, {
    output$network <- renderPlot({
      scholar::get_coauthors(input$id) %>% 
        scholar::plot_coauthors()
    })
  })
}
 
shinyApp(ui = ui, server = server)
4

0 回答 0