Hi,
I am now a PhD student and i want to read abstract using R shiny. I extract a bunch of abstract from the site web of science in an excel file and i just want to create a button to go to the next abstract. Here the code I use
# Importer les données
test <- c("abc","cde","efg")
i=1
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Lire avec R shiny"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
actionButton("suivant",
"Article suivant")
),
# Show a plot of the generated distribution
mainPanel(
textOutput("Abstract")
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
observeEvent(input$suivant,{i<-i+1})
output$Abstract <- renderText({test[i]})
}
# Run the application
shinyApp(ui = ui, server = server)
I don't understand how reactivity quite work with this one and i can't get to change the value of i to parse the next abstract. I did understand that these button needs to be used with observevent or eventreactive but i can figure out how to change the value of i after i notice the change in input$suivant.
Regards