Why my app doesn't deploy on shinyapps.io? - r

I followed the same commands shown in shinyapps.io for uploading my app but I get the following error:
> library(shinyapps)
> shinyapps::deployApp("/Users/mona/CS764/demo")
Error in lint(appDir) : Cancelling deployment: invalid project layout.
The project should have one of the following layouts:
1. 'shiny.R' and 'ui.R' in the application base directory,
2. 'shiny.R' and 'www/index.html' in the application base directory,
3. An R Markdown (.Rmd) document.
Here's the structure of my files:

When using deployApp() you must deploy the directory containing your ui.R and server.R files (or shiny.R / www/index.html if using a custom UI). The files can not be a subdirectory.
Additionally, its important to note that any R files in the directory or any subdirectory will be parsed, so its important that they have valid syntax.

Related

invalid project layout error while deploying shiny app

I want to deploy a shiny app but i am getting this error.
Error in lint(appDir, appFiles, appPrimaryDoc) :
Cancelling deployment: invalid project layout.
The project should have one of the following layouts:
'server.R' and 'ui.R' in the application base directory,
'server.R' and 'www/index.html' in the application base directory,
'app.R' or a single-file Shiny .R file,
An R Markdown (.Rmd) or Quarto (.qmd) document,
A static HTML (.html) or PDF (.pdf) document.
'plumber.R' API description .R file
'entrypoint.R' plumber startup script
A tensorflow saved model
rsconnect::deployApp('Shared/Thomas/thomaps')
thomaps has an r script and a data folder with one excel sheet in it.

Why cannot I call the app when I save the R script as app.R into the working directory?

First of all I set my working directory as following
setwd("C:/Users/asus/Desktop/App-1")
Then I can call the app with the following code:
runApp("C:/Users/asus/Desktop/App-1")
But I cannot call the app via :
runApp("App-1")
The script in the directory is named as "app.R" but it appears in the directory as "app".
Whereas, in the R webpage it says if I create a new directory named App-1 it should have worked. But It does not. Many thanks.

How to use 'shinytest' with 'golem'?

I'm new to 'golem'. So far I did my Shiny apps as packages, with the app in the folder inst/app, and then to use 'shinytest' I made a folder inst/app/shinytest. How to do with 'golem'? There's no app folder: inst/app only contains www, and the UI and the server are some functions in the package.
So I need to know where to put the 'shinytest' script and how to deal with 'testthat' and the expect_pass function? (I don't want to use testServer)
I've found. It suffices to create a file app.R in the app folder with these contents:
mypackage::run_app()

How can I publish R shiny app on https://www.shinyapps.io/?

I am trying to publish R shiny app.But it is giving error that path should be to files within the project directory.
This is for R shiny .I have designed an app where I need to read csv files to it.App is running properly. But, when I am trying to publish it shinyappp server.It is throwing error that path to files should be within the project directory.
I am getting error that paths should to files within the project directory.

R shiny: Retrieve home directory of a shiny app

Is there a function or a way to retrieve the path of root home directory of a shiny app?
The shiny app I run creates multiple directories and changes working directory. But at point in the app, I need to jump to the home directory. getwd() won't work unless I run it first and save it as a variable or something.
I am thinking of something like the below command used to read a file from a package home directory on any platform without knowing the actual path.
#get root dir
system.file()
# read a file from the root dir of a package
a <- system.file("bla",package="foo")
The approach has to work locally, on shiny-server and shinyapps.io. (In situations where I cannot set the path manually).

Resources