How to set Rstudio default working directory back to global default - rstudio

I just got myself into the same predicament that this user did 4 years ago:
How to set back RStudio to global default working directory?
(there is no way to re-enter a "~" using the UI), and the line of code described by the answer (initialWorkingDirectory=) no longer appears to exist in the user-settings file.
Can I find this in a different file somewhere in the Rstudio folder, or is there a different line in the user-settings file I can edit?
Thank you!

Related

Pathway to directory lost in R studio

I am relatively new to R studio, I am attempting to import a .RNK file to run on GSEA. However, the pathway to my working directory is lost and I keep receiving a file, "rt" warning message.
When comparing my working directory with my usual windows explorer file, the files themselves are absent from the working directory.
I have attempted to change the Default text encoding to UTF-8 but this has had no effect. I would be grateful for any suggestions to help with this problem?
That is a very common problem!
You have four options to select the correct file and path! Hope at least one can work well.
Manually without code, you can go to the top and choose Session->Set Working Directory -> Choose Directory... and then select the file.
You can just use the function file. choose() and look for the file on your computer and select it.
You can look for the file path on your computer and write it in R. Look in the local search engine for your computer and search for the file. For example: setwd("~/Desktop/University/Homework")
You can use getwd() in the console to know where the script is working and saving the files and then look for the files there!
PD: the best way to work in R and R-Studio/Posit for me is by creating a project. Doing so, you will have everything related to the script in one folder (new and old files!). It is similar to setwd()but better!

macOS: QFileIconProvider icon(QFileInfo) get icons for non-existent files

I'm trying to implement a file explorer that will display a list of remote files(stored on another network server). And I use QFileIconProvider.icon(QFileInfo) to get the file icon.
The QFileInfo is constructed from a single filename(no path information):
for example: QFileInfo fi("test.jpg");
and that works on both Windows and Linux(I tested it on a Ubuntu machine), but it doesn't work on the macOS. On macOS, I always get the warning
Path given to -[NSWorkspace iconForFile:] is not a full path.
I have checked the solution here: Qt 4.8 - QFileIconProvider, Getting icon for non-existent file (based on extension), but it's for the Windows platform.
I was able to make it work if I created a temporary file on my working directory with the same remote filename. But the temporary needs to be kept. If I deleted the temporary file after calling QFileIconProvider::Icon, I will get the warning above when the QTableView tries to display the QIcon in the UI.
Is there any working solution for my case?
Thanks all.
Since there is no "correctly" solution, I just make a workaround:
Create a temporary file for each file extension, and keep them here, only delete these temporary files when you ensure you don't need them anymore. (I choose to delete them before my app quit.
At least, it works for me.
Thanks!

how to change default settings in .minttyrc programmatically

I want to increase the default font Lucida Console from 9pt to 12pt and adjust the blue color quality. Currently the only way I can find to do it is by right-clicking the Cygwin window and selecting Options & Text and Apply as described in this answer.
I tried to edit .minttyrc to change the font size and color as suggested here. Settings are shown below. But when I relaunch the Cygwin shortcut the default window reappears.
C:\cygwin64\home>cat .minttyrc
FontHeight=12
Blue=127,127,255
BoldBlue=191,191,255
Is there a way to set .minttyrc programmatically ? Surely there is a way to change the default settings without doing this manually every time.
EDIT.
I have Cygwin configured like this ( a screen shot of the window opened by the DOS batch file).
Here is the code suggested by me_and
C:\cygwin64\home\Greg\Work\CMI>cat ~/.minttyrc
cat: '~/.minttyrc': No such file or directory
I can get .bashrc to find .CMI_functions in a sub-directory but I don't know how to get it to find .minttyrc in the same directory
CONCLUSION.
Best results came from editing the Cygwin batch file to relocate all .executable bash files, together with .minttyrc, into C:\cygwin64\home\%USERNAME%.
cd %USERPROFILE%\Desktop\Archive\UTIL
xcopy . C:\cygwin64\home\%USERNAME%\Work\CMI\UTIL /E /I
copy Misc\* C:\cygwin64\home\%USERNAME%\Work\CMI
copy Bash\.* C:\cygwin64\home\%USERNAME%
copy Scripts\*.sh C:\cygwin64\home\%USERNAME%\Work\CMI
The Super User question you've linked to talks about putting the .minttyrc file as ~/.minttyrc, which as a Windows path (at least with default settings) would be something like C:\cygwin64\home\Greg\.minttyrc, but you have it as C:\cygwin64\home\.minttyrc. That's the wrong place, so it's never going to work.
To change the settings for Mintty, you need to have the file in the right location, otherwise it won't be able to load them. Try moving the file to the correct location, and see if that resolves things for you.

How can I automatically change RStudio's options?

I use RStudio on a shared Windows server. I prefer to not have auto-matched parentheses when I code in RStudio. I know I can turn that option off through Tools >> Options >> Code >> Editing >> Insert matching parens/quotes. However, whenever I log onto the server and open RStudio for the first time during a session on that server, all of the changes I made to RStudio's options the last time I was on the server have been reset. Is there a way to ensure that my preferences for RStudio's options persist over time? I do not have admin access to this server, so that may limit my options.
I looked into R profiles and created one to permanently set some options for R, but I did not find any way to set RStudio options that way.
Any help is greatly appreciated!
Global options are stored in a subdirectory described in https://support.rstudio.com/hc/en-us/articles/200534577-Resetting-RStudio-Desktop-s-State. On my Mac it is ~/.rstudio-desktop.
This is not part of the RStudio documented behaviour, so it may change, but I see the setting in the file
.rstudio-desktop/monitored/user-settings/user-settings
This is a plain text file; it looks like YAML to me. The setting you want is in the uiPrefs entry in that file.
What I'd recommend is that you follow the instructions on the web page I mentioned for making a backup of your settings, then restore them when you move to a new machine. If you are very adventurous you could try editing that file, but don't expect it to be easy.

The path environment variable is different depending on where I open cmd

I have an annoying problem where my path environment variable is not correctly updated in new cmd instances.
If I update my path variable and open a new cmd in some folder, the path variable is not updated until i restart my PC. However, I noticed that it IS updated if I open a cmd directly (shift right click open) on my desktop. I have found a workaround using the refresh option in pathmgr, but I find it very curious that the variable is correctly updated in some places but not others.
If someone knows a permanent fix for my problem, or simply why the path variable is updated in my desktop folder but not elsewhere, I would love to hear it. I'm on Windows 7, 64-bit.

Resources