RStudio Programmatically Set Directory in Files Tab - r

I am trying to programmatically set directory in the Files tab within RStudio. The version of RStuido is 1.1.453. I have tried looking within rstudioapi package but the relevant functions that I found selectDirectory() and selectFile() open an interactive file tree browser and they do not change the Files tab content. I know that one can use setwd() then in the Files tab use More -> Go To Working Directory but I need to do this fully programmatically.
In summary I wish there was a function setFilesTab(dirpath = ) which I could submit and the Files tab would change the focus to the dirpath.
Thank you so much for your help and time!

This is my first post on this website; so, hello to all.
I am excited to be part of this community.
Just adding to the answer by RoyalTS, I wanted to specifically tell the files tab to open the working directory. This code works:
rstudioapi::filesPaneNavigate(getwd())
Cheers,
Jason

Related

Trying to import data into R in a way that will allow anyone to access it when opening the markdown file/ accessing the html knit

I am currently working on a coding project and I am running into trouble with how i Should import the data set. We are supposed to have it read in a way so that our instructor can access our markdown file and be able to import the data and run the code without changing file paths. I know about using relative file paths to make it accessible to anyone, however I don't know how to get around the /users/owner part of the file path. Any help would be greatly appreciated and if you have any further questions feel free to ask.
I've tried changing the working directory to a certain folder that both I and my instructor have named the same thing, however, like I said above, when I use read.csv to import the data frame I am still forced to use the /users/owner filepath which obviously is specific to my computer.
I can understand your supervisor, I request the same from my students. My recommended solution is to put both data and R script (or the .Rmd file) in the same folder. Then one does not need to add a path in the read.csv (or similar) function.
If you use RStudio, move to the folder in the Files pane and then use the gear icon and select "Set as Working Directory".
Then send both files (.R or .Rmd) and the data to the supervisor, ideally as a zip file. The supervisor can then unpack it to an arbitrary folder and just double click to the .R/.Rmd file. The containing folder will then automatically become the working directory.
Other options are:
to use a subfolder for the data or
to put the data to a publicly readable internet location, e.g.
Github and read it directly from there.
The last option requires of course that the data have a free license.

RoboHelp is missing ouput preset for CHM generation

Adobe RoboHelp 2020 Trial Version:
The list of available output presets is also missing Responsive HTML5, and Mobile App.
I did have a problem with the PDF output geneation. Error message advised to install Java runtime, as it was missing. After Java installation, PDF genearated. But its bookmarks did not work at all.
I have worked laboriously at learning how to use the RoboHelp; and also took several days to create my project. I desperately need to generate CHM output for a Windows program that I developed. I was devastated when I finally went to generate CHM output/Microsoft HTML Help, it was not on thelist of presets.
That said, I am at wits end, having searched for potential solutions. Can someone please suggest a solution?
Also the Adobe RoboHelp 2020 Trial Version contains the functionality to generate CHM help files.
To add and output the Microsoft HTML Help (CHM) in your presets, click the + icon in the Outputs panel as shown in the screenshot below.
Select Type Microsoft HTML Help
Enter a short Name like CHM
After that it is available for permanent use, e.g. in the Quick Generate window.
I updated RH 2020.
I selected the Microsoft HTML Help preset
I configured the preset: I selected the TOC file. I specified the output folder, which is on a different drive than the project folder. (I knew that it could not be in the location whose parent folder was the project folder.)
Then I clicked the command button to generate the CHM. The progress display continuously indicated the various task that were being performed during the generation process.
Ultimately, I clicked the View Output button. The program displayed an error message indicating that the CHM filed could not be opened. I checked the output designation folder; and, the file existed. However, it was only 1 KB. I double-clicked the CHM file; but, the same error message appeared as when I attempted to open the file from within RoboHelp.
As an aside, I tried he same process with RoboHelp’s sample project, i.e., Compass Travel. And, wouldn’t you know it? The CHM file did properly generate and display; even the bookmarks functioned as expected.
That said, I had mentioned in the original post that I had generated a PDF output. But, the bookmarks did not worked.
Clarification:
The H 1 bookmarks display. However, clicking anyone of the them results in nothing. Whereas most of the H 1 folders have several H 2 subfolders; and there existed two H-3 level items.

Create a SaveTo-Dialog in flexdashboard with shiny

I'm quite lost... I'd like to add a save-button to my shiny/flexdashboard-app. First I tried to use 'shiny files' but it seems that this doesn't work with rmarkdown somehow.
Is there another possibility to create a decent "save-to"-Dialog (like a dialog opens up, one can choose the path and set a filename, hits OK and the file gets saved (the saving-part is no problem))?
Any help is highly appreciated.
Best Regards
Daniel
A combination of downloadButton() (or downloadLink()) and downloadHandler() should also work in flexdashboard. You can find the documentation here.

Is there an R function to click a download button?

I'm trying to write some programs to download a lot of economic data (on the order of hundreds of distinct tables from different websites, that'd need to be updated frequently). Take this website:
http://www.oecd-ilibrary.org/economics/country-statistical-profiles-key-tables-from-oecd_20752288
I want an R program to be able to click on one of those little green buttons that will download an xls file, so I don't have to click it by hand. Is there a package / function in R for this type of thing? (And if not, is there another simple-ish way to do it?)
Thanks!
The buttons just link to .xls files. So, you could use the URL of the page that the button points to, and use that URL as an input to a script / function that does the scraping. There are plenty of packages like rcurl that you could use to manage the download.

How to open non .rda files in R

I am trying to do some work for my thesis which has me using the R programming language (and the R app on Mac OS Lion) for the first time. I had to download the files from here to work with but none of the files comes in .rda or .r they all come in different file extensions. Can someone please tell me how to either convert or use these files?
This page might be relevant to your interests. Also note that if you click on the link on that page that says "Analyze with GEO2R" you can get an R script created for you that will do some of the legwork for you. I would highly suggest reading the instructions on that page in order to get things prepared the way you want them to be.

Resources