r - 无法将类型“闭包”强制为向量
问题描述
我正在开发一个闪亮的应用程序,但无法弄清楚为什么会出现此错误。错误消息说
警告:as.character 中的错误:无法将类型“闭包”强制转换为“字符”类型的向量 [没有可用的堆栈跟踪]
感谢帮助!下面是我的代码
用户界面
library(shiny)
suppressPackageStartupMessages(c(
library(shinythemes),
library(shiny)
))
# give the application a title and browser tab text
appTitle = (div(HTML("<center>Project</center>")))
# create tabs and panels
shinyUI(fluidPage(
titlePanel(appTitle,browserText),
theme = shinytheme("united"),
sidebarLayout(
sidebarPanel(
h3("Overview"),
p("This application will predict next words for you based on the word or phrase you enter.
Please, note that only English is supported."),
h3("Instructions"),
tags$ul(
tags$li("Enter a phrase in English, into the textbox 'Input'"),
tags$li("Click anywhere outside the textbox"),
tags$li("Your 'suggested next word' will appear below the textbox"),
tags$li("Also Your given input will appear below the suggested next word")
),
),
mainPanel(id="mainpanel",
textInput("text", "Input"),
h4("Suggested next word:"),
tags$span(style="color:red",
tags$strong(tags$h3(textOutput("nextWords")))),
h4("Your input:"),
tags$span(style="color:red",
tags$em(tags$h3(textOutput("inputWords")))), align="center"))
)
)
服务器.R
library(shiny)
suppressPackageStartupMessages(
c(library(stringr), library(stylo), library(tm)
))
# include helper functions
source(".//predict.R")
quadgram <- readRDS(file = ".//quadgram.RData")
trigram <- readRDS(file = ".//trigram.RData")
bigram <- readRDS(file = ".//bigram.RData")
# word prediction service
shinyServer(function(input, output) {
nextWord <- reactive({
x <- input$text
y <- callingClean(x)
wCount <- length(y)
nextWord <- getNextWord(wCount,y)})
output$nextWords <- renderPrint(nextWord())
output$inputWords <- renderText({input$text}, quoted = FALSE)
})
解决方案
推荐阅读
- amazon-web-services - 用于 SSL 卸载的 AWS HSM(硬件安全模块)缓慢?
- thread-safety - Guava 的 HashFunction 是线程安全的吗?
- python-3.x - 我在哪里可以获得 Python 3 中 print 函数的 kwargs 列表?
- ios - AVCapturePhotoOutput - 不能重复使用设置
- python - 删除 python 路径硬编码和传递列表
- c++ - C++ 通过映射从基类实现派生类并使用来自
- c# - 变量被重置为零
- excel - Excel对象图通过VBA可见和不可见
- java - 闪存卡显示空白卡 android
- javascript - 如何让机器人在一段时间后删除消息