Open
Description
On startup of a project I want to open two files. I have created .Rprofile file for the project which has the following content -
if(rstudioapi::isAvailable()) {
rstudioapi::navigateToFile('R/ui.R')
rstudioapi::navigateToFile('R/server.R')
}
but whenever I open this project those two files (ui.R and server.R) don't open, nor is there any error message regarding it. I think that is because rstudioapi::isAvailable() returns FALSE.
To confirm, I removed the if condition from .Rprofile and I get Error: RStudio not running.
How do I fix this? I think this issue #100 is similar to mine but it is not yet resolved and I was unable to use the hook suggestion.
Any ideas?
Reacted by olivroy
Metadata
Metadata
Assignees
Labels
No labels
Activity
gadenbuie commentedon Nov 29, 2022
I think this will work if you add it to the
.Rprofilein your project.shahronak47 commentedon Nov 30, 2022
Thanks @gadenbuie , that worked. But I don't know this somehow blocks using the
Run Appbutton for shiny. As you mentioned I added this in my.Rprofilefile and it opens these twouiandserverfiles upon launch but when I click onRun Appbutton it printrunapp('R/')in the console and waits. Nothing happens after that.Do you have any idea what might be causing that?