.Hello, dear colleagues! I am an experienced programmer (from Hungary) in R, and I recently wrote a program that creates text concordances using the kwic() function of the quanteda package, and the program works flawlessly. Then I decided to write the same program in R Shiny, as it would be elegant to enter the search term dynamically using textInput. I don't want to write the entire script here, even though it is very simple. The important facts:
I am using the well-established sample text, i.e., the corpus named 'data_corpus_inaugural'. My program loads it correctly—I checked it on the console. The error can only be with the main part, the kwic function, which looks like this:
kwic_result <- eventReactive({
kwic_res <- kwic(kopo, pattern = input$kw, valuetype = "fixed", window = 3)
})
After program start the script throws the following error message: "argument "expr" is missing, with no default"
Could you help me, please?
..
You are currently calling eventReactive() with a single argument, but it needs at least 2:
- eventExpr (e.g. your event or trigger) and
- valueExpr, which you seem to have.
Something like
ui <- fluidPage(
textInput("kw", "kw"),
actionButton("go", "go")
)
server <- function(input, output, session) {
...
kwic_result <- eventReactive(
input$go,
kwic(kopo, pattern = input$kw, valuetype = "fixed", window = 3)
)
...
}
might do.