我在UI.R上有一个textInput,我想用它作为 过滤到我在GLOBAL.R上的sqldf中的查询,但我知道如何做到这一点。 任何人都可以帮助我吗?
这是我的UI.R
fluidPage(Application title titlePanel("Robsonb - CRAI"),
sidebarLayout(
# Sidebar with a slider and selection inputs
sidebarPanel(
selectInput("selection", "Escolha uma lista:",
choices = books),
actionButton("update", "Alterar"),
hr(),
textInput(inputId="descritor",value="cárie", label = ""),
sliderInput("freq",
"Minimum Frequency:",
min = 1, max = 50, value = 15),
sliderInput("max",
"Maximum Number of Words:",
min = 1, max = 300, value = 100)
),
# Show Word Cloud
mainPanel(
plotOutput("plot"),
textOutput("descritor")
) ) )
这是我的Global.R,我在那里进行SQL查询。我打算做点什么 像sqldf(“选择Assuntos,来自结果O3的sysno在哪里 [Resumo.em.português]喜欢。我正在使用闪亮的包装。
library(tm)
library(wordcloud)
library(memoise)
library(sqldf)
# The list of valid books
books <<- list("Resumo de Teses FOUSP" = "tesesFO"
)
# Using "memoise" to automatically cache the results
getTermMatrix <- memoise(function(book) {
# Careful not to let just any name slip in here; a
# malicious user could manipulate this value.
if (!(book %in% books))
stop("Base não encontrada")
outcome <- read.csv2("TesesFOResumo.csv", colClasses = "character")
#input<- input$descritor
sqldf("select Assuntos, sysno from outcome O3 where [Resumo.em.português] LIKE '%cárie%' UNION ALL
select Assuntos, sysno from outcome O1 where sysno in (select sysno from outcome O2 where assuntos LIKE '%cárie%')")
text <- sqldf("select Assuntos, sysno from outcome O3 where [Resumo.em.português] LIKE '%cárie%' UNION ALL
select Assuntos, sysno from outcome O1 where sysno in (select sysno from outcome O2 where assuntos LIKE '%cárie%')")
myCorpus = Corpus(VectorSource(text))
myCorpus = tm_map(myCorpus, content_transformer(tolower))
myCorpus = tm_map(myCorpus, removePunctuation)
myCorpus = tm_map(myCorpus, removeNumbers)
myCorpus = tm_map(myCorpus, removeWords,
c(stopwords("SMART"), "de", "da", "dos", "the", "and", "but"))
myDTM = TermDocumentMatrix(myCorpus,
control = list(minWordLength = 1))
m = as.matrix(myDTM)
sort(rowSums(m), decreasing = TRUE)
})