I am new to Rstudio and Shiny. I am in need of running python code when we click a button in UI I created in shiny app. Is it possible to do this?
Attaching the code of UI.
library(shiny)
You can source python functions and use it as any other function in R by using the reticulate package, but you can't directly use python syntax on a shiny app.
@andresrcs So how can I import the python code in shiny app when I click a button? Do you guys have an example to post? Or can you edit my code and add like dumb python code and post it?
Using a command like this `reticulate::source_python("python_script.py")
But sourcing your python code each time you press a button doesn't sound like a good idea, it would be better to source your python function at session level and then use that function in your button as it was regular R code.
If you need more specific help please provide a minimal reproducible example (reprex) illustrating your issue. Have a look at this guide, to see how to create one for a shiny app