inst/examples/example_rds.R

#library(shinyChatR)

# # initiate chat data df.
# df <- data.frame(rowid = numeric(),
#                  user = character(),
#                  text = character(),
#                  time = double())

# save rds file in tempdir. Replace with path to save locally.
test_rds <- file.path(tempdir(), "data2.rds")
# saveRDS(df, test_rds)

ui <- fluidPage(

  fluidRow(
    column(width = 6,
           # add chat ui elements
           chat_ui("test2"),
    )
  )
)

server <- function(input, output, server) {

  # corresponding server part for id test2
  chat_server("test2",
              rds_path = test_rds,
              chat_user = "user2"
              )
}


# Run the application
shinyApp(ui = ui, server = server)

Try the shinyChatR package in your browser

Any scripts or data that you put into this service are public.

shinyChatR documentation built on May 29, 2024, 8:18 a.m.