[R] shinyFiles update shinySaveButton filename varaible from server

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Fri Jun 4 16:20:27 CEST 2021


Note, per the Posting Guide (linked below),

"For questions about functions in standard packages distributed with R (see
the FAQ Add-on packages in R
<https://cran.r-project.org/doc/FAQ/R-FAQ.html#Add-on-packages-in-R>), ask
questions on R-help.

If the question relates to a *contributed package* , e.g., one downloaded
from CRAN, try contacting the package maintainer first. You can also use
find("functionname") and packageDescription("packagename") to find this
information. *Only* send such questions to R-help or R-devel if you get no
reply or need further assistance. This applies to both requests for help
and to bug reports."

So do not be surprised if you do not get a response here.


Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Thu, Jun 3, 2021 at 11:00 PM nevil amos <nevil.amos using gmail.com> wrote:

> Is it possible to update the filename variable  the shinySaveButton from
> the server?
>
> I want to provide a default  filename based on a series of choices that the
> user has made in the app ( here I have just made a random string to serve
> the purpose.  how do I feed output$defaultname
>  so that shinySaveButton( filename = outputSdefaultname )?
>
>
> library(shiny)
> library(shinyFiles)
>
> data <- iris
> roots <- c("UserFolder"=".")
>
> ui <- fluidPage(
>   actionButton("makeName","Make Default File Name"),
>   shinySaveButton(id = "save", label = "Save file", title = "Save file as
> ...", filename = "defaultname",filetype=list(csv="csv"))
> )
>
>
> server <- shinyServer(function(input, output, session) {
>   rv <- reactiveValues()
>   observeEvent(input$makeName,{
>     output$defaultname<-paste(letters[sample(1:10,5)],collapse="")
>   })
>
>   observe({
>
>
>     shinyFileSave(input, "save", roots=roots, session=session)
>     fileinfo <- parseSavePath(roots, input$save)
>     xx<<-input$save
>     if (nrow(fileinfo) > 0) {
>       write.csv(, as.character(fileinfo$datapath))
>
>     }
>     session$allowReconnect("force")
>   })
> })
>
> runApp(list(
>   ui=ui,
>   server=server
> ))
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list