I have a shiny app which has a ui.R, server.R and global.R. The app directory (name = dash) contains the folder 'data' in which the dataset resides. Also, this app folder is inside the project's working directory. In global.R I read the data as:
dash <- read.table("data/ntraj1acc.txt", sep=",", header=T)
This app works fine. Now, I am trying to embed it in a ioslides presentation which otherwise works good. The example in External Applications section on rmarkdown website also works perfect in my presentation. But when I replace the path in system.file
to my app, I get the error:
No Shiny application exists at the path ""
Here is how I replaced the path:
shinyAppDir(
system.file("dash", package="shiny"),
options=list(
width="100%", height=700
)
)
After the error, I tried following:
shinyAppDir(
"C:/Users/durraniu/Documents/Trajectory-one/dash",
options=list(
width="100%", height=700
)
)
But then I got a new error:
object 'dash' not found
Which means that it is not parsing global.R.
How can I fix this problem?
There are two ways to do this: Defining the application inline using the shinyApp() function; or. Referring to an external application directory using the shinyAppDir() function.
Yes! A shiny app can be put in an iframe in another website from RStudio Connect. In order to put the app in an iframe, it is recommended to add a content URL, because you can move it to another piece of content should the need arise.
It generally comes down to the amount of interactivity you need in your app. For a full solution where data is updated and processed in real-time, Shiny is your best option. If you just need a nice format for presentation offline, then RMarkdown can produce some very nice looking formats.
I successfully embeded an application within an interactive shiny document with the following rmarkdown chunk:
```
shinyAppDir("D:/Documents/OneDrive/Notes/R-Explore/shiny/01-ages/",
options=list(
width="100%", height=550
)
)
```
All 3 files: the ui.R, server.R, and test.Rmd are at the above absolute path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With