problem with setting a directory

Hello!

I'm using the newest version of r and RStudio to do data analysis.
But there is a problem with setting directory in RStudio: when I make a new folder in desktop, it is not shown in rstudio files. Also when I make a new folder via file window of rstudio, and set it as working directory, and save my analysis results to this folder; this folder doesn't exist in my system. Actually I can't set any directory and can't see any saved results on system.
I have updated my computer windows 11, and also tried previous versions of R and RStudio, but the problem is still present.

What's the reason for this problem and how can I fix it?
(I use Open source 2024.04.1+748f Version of RStudio for windows 11)
Thanks for your helps in advance!

Does the files window in RStudio show your existing desktop files and folders correctly? If so, when you make a new folder on the desktop, try clicking the refresh button (circular arrow icon, top right of the files window in RStudio) and see if the new folder shows up.

Hi @mehrnaz_izadan
I recommend that you try using the Project feature in RStudio -it handles the directories easily (existing ones and new ones) and keeps your data, script and output files in a well-organised way.

thank you for your reply.
no it doesn't show any existing desktop file and folder correctly .
I tried to make a new folder and then I refreshed but it did not show a new folder.

What do you see in the RStudio files window (what directory)?

If you go to Tools > Global Options... > General and select the "Basic" tab, what is entered under "Default working directory"?

I prefer to send you screenshots


If you click the "desktop" link in the file viewer, do you not get your desktop?

no I don not get access to my Desktop.
when I install RStudio at first , this file didnt exist in RStudio ("desktop"), and I made it my self (with useing this way : click on " new folder" then choosing a name for this file.

Do the other folders showing in the viewer (in particular, "Custom Office Templates" and "TuneFab Software Inc") exist in your user home directory? If not, is it possible that you are running RStudio under a user account other than your normal one? Also (it's been a while since I used Windows), where does your desktop folder live? (If you open a directory app and navigate to your home directory, is the desktop folder in your home directory or is there a longer path to it?)

I dont know what the problem is? but following your question , I opened a script from the previous code on my desktop (useing the 'open with RStudio' option) ,and this path was shown to me(I put the screenshot below).
in this way , I was able to save my files on desktop and read files from directory.

So I take it the problem occurs when you first start RStudio from the Start menu? Can you check what the start menu shortcut has for a command? It might be setting an incorrect home directory.

There's one other thing you can try that might fix the problem (but would not explain why it is happening). You can select Tools > Global Options... > General > and in the "Default working directory" box change "~" to "C:\Users\SKY" (if that's your home directory) and click OK. This requires that you be able to browse to the correct home directory -- I don't think RStudio will let you just type the path into the field. I believe you will need to restart RStudio for it to take effect. If that does not set the viewer to the correct directory, replace the path with "~".

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.