Hi,
Welcome to the RStudio community!
Here is an example:
library(shiny)
ui <- fluidPage(
actionButton("btn","Save locally")
)
server <- function(input, output, session) {
observeEvent(input$btn, {
write.csv(data.frame(x = 1:10), "myData.csv")
})
}
shinyApp(ui, server)
This will write the file to the Shiny app folder. You can set a relative path from there. Beware though that if you are running this on a server, going up from the app root folder might cause issues, as Shiny is supposed to run everything within its own folder. Saving in subfolders from the main one is no issue. On a local machine, using absolute or relative paths should not cause issues.
Hope this helps,
PJ