Is there any way to open the default Windows Images folder with the fileInput component?
Right now it is opening "My Computer" and I don't want this behaviour.
Yes, I believe this is possible. However, it involves changing your global directory in R. This process is good if you're only going to be using the one directory for a while. To do this:
Go into RStudio
Select "Tools" -> "Global Options.."
You should see something like the image above, then you can select "Browse..." in the red box which will bring up a folder selector, from here you can set your new permanent working directory
Once you've selected your folder, hit "Apply" and then "Ok"
After you've done this when you open your shinyApp with a fileInput the default should be the global path you just set.
Related
Is there any interaction from R to RStudio possible?
I would really like, for example, to set the RStudio files pane directory from the R console, like setFilesPane(getwd()) or such. I haven't found anything though.
Edit: To clarify: In RStudio there is a "files pane" (bottom right)
This can be navigated like any file explorer. However I would like to set the files pane directory (the directory whose contents are shown in the files pane) from my R code instead of having to navigate to my project folder by hand every time. Is there any way to do this?
Was answered by #docendodiscimus:
click the arrow at the top of the console pane (bottom left)
Thanks!
rstudioapi::filesPaneNavigate() ought to do what you're looking for.
I am using fileInput in shiny. Now, what I would like to do is to define the folder which is shown based on the fileInput download button. So, e.g. I would like to make sure that the explorer window opens C:/test/test instead of its default library (which could e.g. be C:/test). So, I would like to specify something like
fileInput("PE_TS","",multiple=FALSE,path="C:/test/test)
where path is the path I would want to be shown in the explorer.
How would I do this?
There is a package called shinyFiles
https://github.com/thomasp85/shinyFiles
I haven't tried it myself, but I noticed it has a root parameter, so it might do what you want
I can use a() to add a hyperlink in to an external site from my Shiny app,
a("google",href="http://www.google.com")
but how do I make a link to open a pdf (or similar) file? Seems like it should be simple, but I can't find any examples. My question is similar to this one:
Add link to R Shiny Application so link opens in a new browser tab
but I don't know how to structure the href part- where do I put the file to be opened and how do I specify its location? I've tried simple things like http:///C:/Folder/file.pdf or file:///C:/Folder/file.pdf but the file is either not found or wont open.
I am new to shiny and have no html experience, so any suggestions greatly appreciated.
Thanks
Put the pdf file inside the "www" directory (it has to be a subdirectory inside the directory where there are ui.r and server.r )
then you can run your shiny with:
a("click on me",target="_blank",href="myfile.pdf")
Given a file or path - I can use FileUtils (or similar) to work with files. I'd like to be able to alter the current working directory in my extension.
I see in node.js there is process.chdir(directory) but I am unable to access that object.
Is there any other way to change the current working directory.
I am trying to create a simple plugin that when you open the file dialog, the directory your file listing is the same as the currently opened file. The simple implementation being:
MainViewManager.on("currentFileChange", function (e, newFile) {
process.chdir(newFile.parentPath); // This is my FAIL
});
Brackets, like many GUI apps, doesn't use the current working directory very much once it's up and running. So there is probably a different way to accomplish what you're looking for.
When you say...
when you open the file dialog, the directory your file listing is the same as the currently opened file.
...do you mean you want the file tree on the left side of the window to change? If so, try the ProjectManager.openProject() API.
...or do you mean you want to open a file-picker dialog box (like what you see when you choose File > Open in the menu)? If so, you can use FileSystem.showOpenDialog() - the 4th argument is the directory to show when the dialog is first opened.
Since a project can have hundreds of files inside dozens of directories (filters) shown on the "Project Navigator" panel, sometimes it's getting difficult to seek the file which is currently opened in the Editor (for example, when I jump from file to file via "CMD + clicking", etc).
Is there a way to automatically select currently opened file on the "Project Navigator" panel? I.e., automatically expand the directories (filters) and select the file there as I would have clicked on it? Maybe there's a shortcut or something?
Thanks.
The keyboard shortcut is ⌘-shift-J
Right-click the file in the editor and choose Reveal in Project Navigator.
Another option is to Right click anywhere within the Editor pane (with the source code) -> Navigate -> Reveal in Project Navigator.