Skip to content

Windows standard interface: change working dorectory

14 messages · Calboli Federico (LUKE), Erin Hodgess, Michael Dewey +4 more

#
Hello,

I need to provide the simplest possible indication to R users with either windows or macos machines on how to change working directory. Using setwd() will not work because I cannot trust them to even understand the concept of working directory.

On macos it is possible to have a GUI menu (the standard R GUI) that would allow the users to "click their way to where their data files are", is there such facility for the windows R GUI (the out-of-the-box one)? I have no access to windows machines, so I cannot check, but I am sure some people will use a windows laptop.

F


--

Federico Calboli

Erityisasiantuntija, tutkimusrahoitus

Palveluryhm?t

Luonnonvarakeskus
#
Dear Federico

If they click on File in the top left hand corner and then Change dir in 
the drop-down menu if opens a file explorer type window where they can 
click on directories (folders in MS-speak) in the usual way. That does 
not get round the problem that they need to know where they put the file 
in the first place of course but it might help some of them.

Michael
On 08/12/2025 11:22, Calboli Federico (LUKE) wrote:

  
    
#
Thanks! That sorts it! I?ll tell people to put files on their desktops, and that should suffice.

F


--

Federico Calboli

Erityisasiantuntija, tutkimusrahoitus

Palveluryhm?t

Luonnonvarakeskus

Dear Federico

If they click on File in the top left hand corner and then Change dir in
the drop-down menu if opens a file explorer type window where they can
click on directories (folders in MS-speak) in the usual way. That does
not get round the problem that they need to know where they put the file
in the first place of course but it might help some of them.

Michael
On 08/12/2025 11:22, Calboli Federico (LUKE) wrote:
--
Michael Dewey
#
People who use computers should understand file names. It does not matter if you call them folders or directories they are the same animal.
I have a file called "my_file"
Where does it live? "On my computer" is like saying my mailing address is "Earth." 

All files have a memory location in your computer where the computer can find the file contents. All names consist of two, but more commonly three parts: location, name, type. These answer "where is the file," "what is it called," and "what kind of file?" The format for location is disk drive followed by an ordered list of (directories or folders) from outer to innermost. I am on Windows, so for me this looks like c://dir1/dir2/dir3/. In words, I look on my hard drive named "C" and will find a directory called dir1. Inside dir1 will be dir2 and inside that will be dir3 where I can find my file.

File names typically end with a period followed by the type of file. .xlsx for an Excel file, .txt for a text file, .csv for comma separated values file, docx for a Microsoft word file. Most of the time on Windows the extension is hidden, and the path is shown at the top of the window. This was all very obvious in the old days working with DOS, but windows made things "easy" and took this away from the default output. In any case, files are all saved something like this: "c://dir1/dir2/dir3/my_file.docx". 

I have multiple projects in R. I could change the working directory in R multiple times each day and try to keep up. I am bad at that. My solution is that I never change the working directory, so all read and write statements include the full file name, path and all. I can then switch between projects and not worry about where to read or save things and I do not sometimes get files saved in strange places. One could set the working directory at the start of each program, but that assumes that I want to always start working at the top of each program. I have not had much luck with that approach.

I sometimes write software for others to use. In this case I give users a popup window where they select their file using a graphical interface and then the program extracts the path from where the user got the file. This path is then added to the file name the user provides to save output. In this way I do not have to worry about the difference between "c://dir1/dir2/dir3/my_file.docx" and "c:\\dir1\dir2\dir3\my_file.docx"

Regards,
Tim

-----Original Message-----
From: R-help <r-help-bounces at r-project.org> On Behalf Of Calboli Federico (LUKE)
Sent: Monday, December 8, 2025 6:22 AM
To: r-help at r-project.org
Subject: [R] Windows standard interface: change working dorectory

[External Email]

Hello,

I need to provide the simplest possible indication to R users with either windows or macos machines on how to change working directory. Using setwd() will not work because I cannot trust them to even understand the concept of working directory.

On macos it is possible to have a GUI menu (the standard R GUI) that would allow the users to "click their way to where their data files are", is there such facility for the windows R GUI (the out-of-the-box one)? I have no access to windows machines, so I cannot check, but I am sure some people will use a windows laptop.

F


--

Federico Calboli

Erityisasiantuntija, tutkimusrahoitus

Palveluryhm?t

Luonnonvarakeskus
#
As much I might agree with you in theory, people here are just using R to produce some graphs using one line of code I generated, so they can do the job they are paid to do (which is not computing). Producing said graph and its permutations would be more complex in any other way, and I want to make sure the instructions I printed out for them are as simple, accessible, and require the least amount of supervision.

F


--

Federico Calboli

Erityisasiantuntija, tutkimusrahoitus

Palveluryhm?t

Luonnonvarakeskus

People who use computers should understand file names. It does not matter if you call them folders or directories they are the same animal.
I have a file called "my_file"
Where does it live? "On my computer" is like saying my mailing address is "Earth."

All files have a memory location in your computer where the computer can find the file contents. All names consist of two, but more commonly three parts: location, name, type. These answer "where is the file," "what is it called," and "what kind of file?" The format for location is disk drive followed by an ordered list of (directories or folders) from outer to innermost. I am on Windows, so for me this looks like c://dir1/dir2/dir3/. In words, I look on my hard drive named "C" and will find a directory called dir1. Inside dir1 will be dir2 and inside that will be dir3 where I can find my file.

File names typically end with a period followed by the type of file. .xlsx for an Excel file, .txt for a text file, .csv for comma separated values file, docx for a Microsoft word file. Most of the time on Windows the extension is hidden, and the path is shown at the top of the window. This was all very obvious in the old days working with DOS, but windows made things "easy" and took this away from the default output. In any case, files are all saved something like this: "c://dir1/dir2/dir3/my_file.docx".

I have multiple projects in R. I could change the working directory in R multiple times each day and try to keep up. I am bad at that. My solution is that I never change the working directory, so all read and write statements include the full file name, path and all. I can then switch between projects and not worry about where to read or save things and I do not sometimes get files saved in strange places. One could set the working directory at the start of each program, but that assumes that I want to always start working at the top of each program. I have not had much luck with that approach.

I sometimes write software for others to use. In this case I give users a popup window where they select their file using a graphical interface and then the program extracts the path from where the user got the file. This path is then added to the file name the user provides to save output. In this way I do not have to worry about the difference between "c://dir1/dir2/dir3/my_file.docx" and "c:\\dir1\dir2\dir3\my_file.docx"

Regards,
Tim

-----Original Message-----
From: R-help <r-help-bounces at r-project.org> On Behalf Of Calboli Federico (LUKE)
Sent: Monday, December 8, 2025 6:22 AM
To: r-help at r-project.org
Subject: [R] Windows standard interface: change working dorectory

[External Email]

Hello,

I need to provide the simplest possible indication to R users with either windows or macos machines on how to change working directory. Using setwd() will not work because I cannot trust them to even understand the concept of working directory.

On macos it is possible to have a GUI menu (the standard R GUI) that would allow the users to "click their way to where their data files are", is there such facility for the windows R GUI (the out-of-the-box one)? I have no access to windows machines, so I cannot check, but I am sure some people will use a windows laptop.

F


--

Federico Calboli

Erityisasiantuntija, tutkimusrahoitus

Palveluryhm?t

Luonnonvarakeskus
#
Files come from somewhere. Where do the files you are referring to come from? Where will it go after you are done with it?

Most of the time files that inexperienced users deal with come from downloads using a web browser, and most of the time they are directed into a Downloads folder. Whether you use that or the desktop, if the files build up over time then that group of similar files will get larger without bound. Will you support deleting the files once you are done with them?

R can read files from a URL directly almost as easily as it can from a directory. Can you make R aware of that location? 

If you have another program generating the file, can you have it put it into an agreeable place? If so, a temporary directory or filename may be sufficient, since the OS will clean that out occasionally (though cleaning up after yourself is a better solution.
On December 8, 2025 6:24:29 AM PST, "Calboli Federico (LUKE)" <federico.calboli at luke.fi> wrote:
--
Sent from my phone. Please excuse my brevity.
#
Jeff,

users will get the files they need to fill in on Teams, and will save them wherever they like. They will need to use R for image creation, but they are not trained for computing so they know where their stuff is, but I do not mean to expect they can use setwd() to set the working directory, or start with concepts such as working directory. Now they have the option of clicking their way to their files, they have been told their outputs will be next to those, and that is it.

I have work to do, I do not run a circus. My users have now the ability to run the scripts I wrote for them, get the images they need without the need for direct support, and we can go forth and get the stuff we get paid to do done. Sorry if using R as a tool for work offends.

F


--

Federico Calboli

Erityisasiantuntija, tutkimusrahoitus

Palveluryhm?t

Luonnonvarakeskus

Files come from somewhere. Where do the files you are referring to come from? Where will it go after you are done with it?

Most of the time files that inexperienced users deal with come from downloads using a web browser, and most of the time they are directed into a Downloads folder. Whether you use that or the desktop, if the files build up over time then that group of similar files will get larger without bound. Will you support deleting the files once you are done with them?

R can read files from a URL directly almost as easily as it can from a directory. Can you make R aware of that location?

If you have another program generating the file, can you have it put it into an agreeable place? If so, a temporary directory or filename may be sufficient, since the OS will clean that out occasionally (though cleaning up after yourself is a better solution.
On December 8, 2025 6:24:29 AM PST, "Calboli Federico (LUKE)" <federico.calboli at luke.fi> wrote:
As much I might agree with you in theory, people here are just using R to produce some graphs using one line of code I generated, so they can do the job they are paid to do (which is not computing). Producing said graph and its permutations would be more complex in any other way, and I want to make sure the instructions I printed out for them are as simple, accessible, and require the least amount of supervision.

F


--

Federico Calboli

Erityisasiantuntija, tutkimusrahoitus

Palveluryhm?t

Luonnonvarakeskus

People who use computers should understand file names. It does not matter if you call them folders or directories they are the same animal.
I have a file called "my_file"
Where does it live? "On my computer" is like saying my mailing address is "Earth."

All files have a memory location in your computer where the computer can find the file contents. All names consist of two, but more commonly three parts: location, name, type. These answer "where is the file," "what is it called," and "what kind of file?" The format for location is disk drive followed by an ordered list of (directories or folders) from outer to innermost. I am on Windows, so for me this looks like c://dir1/dir2/dir3/. In words, I look on my hard drive named "C" and will find a directory called dir1. Inside dir1 will be dir2 and inside that will be dir3 where I can find my file.

File names typically end with a period followed by the type of file. .xlsx for an Excel file, .txt for a text file, .csv for comma separated values file, docx for a Microsoft word file. Most of the time on Windows the extension is hidden, and the path is shown at the top of the window. This was all very obvious in the old days working with DOS, but windows made things "easy" and took this away from the default output. In any case, files are all saved something like this: "c://dir1/dir2/dir3/my_file.docx".

I have multiple projects in R. I could change the working directory in R multiple times each day and try to keep up. I am bad at that. My solution is that I never change the working directory, so all read and write statements include the full file name, path and all. I can then switch between projects and not worry about where to read or save things and I do not sometimes get files saved in strange places. One could set the working directory at the start of each program, but that assumes that I want to always start working at the top of each program. I have not had much luck with that approach.

I sometimes write software for others to use. In this case I give users a popup window where they select their file using a graphical interface and then the program extracts the path from where the user got the file. This path is then added to the file name the user provides to save output. In this way I do not have to worry about the difference between "c://dir1/dir2/dir3/my_file.docx" and "c:\\dir1\dir2\dir3\my_file.docx"

Regards,
Tim

-----Original Message-----
From: R-help <r-help-bounces at r-project.org> On Behalf Of Calboli Federico (LUKE)
Sent: Monday, December 8, 2025 6:22 AM
To: r-help at r-project.org
Subject: [R] Windows standard interface: change working dorectory

[External Email]

Hello,

I need to provide the simplest possible indication to R users with either windows or macos machines on how to change working directory. Using setwd() will not work because I cannot trust them to even understand the concept of working directory.

On macos it is possible to have a GUI menu (the standard R GUI) that would allow the users to "click their way to where their data files are", is there such facility for the windows R GUI (the out-of-the-box one)? I have no access to windows machines, so I cannot check, but I am sure some people will use a windows laptop.

F


--

Federico Calboli

Erityisasiantuntija, tutkimusrahoitus

Palveluryhm?t

Luonnonvarakeskus



________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html<https://www.r-project.org/posting-guide.html>
and provide commented, minimal, self-contained, reproducible code.

--
Sent from my phone. Please excuse my brevity.
#
Hello!

What about file.choose?

Would that help?

Erin Hodgess, PhD
mailto: erinm.hodgess at gmail.com


On Mon, Dec 8, 2025 at 10:28?AM Calboli Federico (LUKE) <
federico.calboli at luke.fi> wrote:

            

  
  
#
If they are going to run a script which you have prepared for them then 
they can click on File and then click on Source R code which opens the 
same Explorer type window but only shows runnable files.

 From the responses you are getting I think most people on this list do 
not come into contact with people who are so ignorant of computing 
basics. They are fortunate.

Michael
On 08/12/2025 17:27, Calboli Federico (LUKE) wrote:

  
    
#
This sounds more like there are some hourly employees that you do not want to train but they need to produce a graph for you. In this case I would use a package in R called Shiny to create an app. The worker opens the app, types in the file name and the app sends you the graph. The employee will never see the R code. This level of use in Shiny is about as basic as it gets. It costs you time to learn Shiny basics, but it will save you time in not having to train employees. If written properly, the employee only needs to know how to find their data file (which probably should be saved in your company TEAMS folder, and not some personal computer).

An R user writes code (good or bad but writes code) and therefore does computing. It sounds like your employees would not qualify as R users and you want to keep it this way. Lock the R code in a Shine app and you do not have to worry about any of this.

See:
https://shiny.posit.co/

Tim


From: Calboli Federico (LUKE) <federico.calboli at luke.fi>
Sent: Monday, December 8, 2025 9:24 AM
To: Ebert,Timothy Aaron <tebert at ufl.edu>; r-help at r-project.org
Subject: Re: Windows standard interface: change working dorectory

[External Email]
As much I might agree with you in theory, people here are just using R to produce some graphs using one line of code I generated, so they can do the job they are paid to do (which is not computing). Producing said graph and its permutations would be more complex in any other way, and I want to make sure the instructions I printed out for them are as simple, accessible, and require the least amount of supervision.

F



--

Federico Calboli

Erityisasiantuntija, tutkimusrahoitus

Palveluryhm?t

Luonnonvarakeskus
People who use computers should understand file names. It does not matter if you call them folders or directories they are the same animal.
I have a file called "my_file"
Where does it live? "On my computer" is like saying my mailing address is "Earth."

All files have a memory location in your computer where the computer can find the file contents. All names consist of two, but more commonly three parts: location, name, type. These answer "where is the file," "what is it called," and "what kind of file?" The format for location is disk drive followed by an ordered list of (directories or folders) from outer to innermost. I am on Windows, so for me this looks like c://dir1/dir2/dir3/. In words, I look on my hard drive named "C" and will find a directory called dir1. Inside dir1 will be dir2 and inside that will be dir3 where I can find my file.

File names typically end with a period followed by the type of file. .xlsx for an Excel file, .txt for a text file, .csv for comma separated values file, docx for a Microsoft word file. Most of the time on Windows the extension is hidden, and the path is shown at the top of the window. This was all very obvious in the old days working with DOS, but windows made things "easy" and took this away from the default output. In any case, files are all saved something like this: "c://dir1/dir2/dir3/my_file.docx".

I have multiple projects in R. I could change the working directory in R multiple times each day and try to keep up. I am bad at that. My solution is that I never change the working directory, so all read and write statements include the full file name, path and all. I can then switch between projects and not worry about where to read or save things and I do not sometimes get files saved in strange places. One could set the working directory at the start of each program, but that assumes that I want to always start working at the top of each program. I have not had much luck with that approach.

I sometimes write software for others to use. In this case I give users a popup window where they select their file using a graphical interface and then the program extracts the path from where the user got the file. This path is then added to the file name the user provides to save output. In this way I do not have to worry about the difference between "c://dir1/dir2/dir3/my_file.docx" and "c:\\dir1\dir2\dir3\my_file.docx"

Regards,
Tim

-----Original Message-----
From: R-help <r-help-bounces at r-project.org<mailto:r-help-bounces at r-project.org>> On Behalf Of Calboli Federico (LUKE)
Sent: Monday, December 8, 2025 6:22 AM
To: r-help at r-project.org<mailto:r-help at r-project.org>
Subject: [R] Windows standard interface: change working dorectory

[External Email]

Hello,

I need to provide the simplest possible indication to R users with either windows or macos machines on how to change working directory. Using setwd() will not work because I cannot trust them to even understand the concept of working directory.

On macos it is possible to have a GUI menu (the standard R GUI) that would allow the users to "click their way to where their data files are", is there such facility for the windows R GUI (the out-of-the-box one)? I have no access to windows machines, so I cannot check, but I am sure some people will use a windows laptop.

F


--

Federico Calboli

Erityisasiantuntija, tutkimusrahoitus

Palveluryhm?t

Luonnonvarakeskus
3 days later
#
One of the things that has really simplified things for my students is 
using RStudio to run R, and then always creating (working within) an 
RProject.

The location of the RProject becomes the default location (home folder) 
for all related files in the project.? It dispenses with having to teach 
the students too much about absolute and relative paths, and it is very 
flexible in the sense that you can move a folder from one drive to 
another or from one computer to another, and things still work as long 
as you start R (RStudio) with the same project selected.

I had no end of agony with "path confusion" before using this approach.

Rob
On 12/8/2025 5:22 AM, Calboli Federico (LUKE) wrote:

  
    
#
I reply as a passive observer and not one with insight or advice. So
certainly no need to respond.

I am just amazed that in this day and age students of any sort in higher
education institutions of any sort have difficulty understanding the basics
of (the tree structure of) file organization on any sort of computer. I
suspect that this reflects my profound ignorance of how most of today's
young people have interacted with the manifold computational resources that
they use every day through brilliantly crafted UI's. Still, I would have
assumed that such knowledge would be basic to any "higher education" these
days. Silly me...

Cheers,
Bert


On Thu, Dec 11, 2025 at 4:54?PM Robert Baer via R-help <r-help at r-project.org>
wrote:

  
  
#
My wife was a returning college student 10 years ago, and her stories to me of her upper division engineering students coping with files and Excel corroborate this deficiency. She was rather more computer-literate than average, but was still apprehensive about piling R on top of her engineering workload at that time. She later did a Master's and finally started using R and has expressed regret that she did not start using it sooner... but I meet engineers all the time who can barely use Excel much less a scripting language.

I suspect that ubiquitous GUI programs create a conceptual gap with text-based programming and hierarchical thinking. People are able to skim by all their lives without ever having to organize information.. just type in questions to Google... so why should they start now?
On December 11, 2025 6:37:59 PM PST, Bert Gunter <bgunter.4567 at gmail.com> wrote:
--
Sent from my phone. Please excuse my brevity.
#
I gave up when I started encountering people who thought computer literacy was how to use Word and Excel.

-----Original Message-----
From: R-help <r-help-bounces at r-project.org> On Behalf Of Jeff Newmiller via R-help
Sent: Thursday, December 11, 2025 10:17 PM
To: Bert Gunter <bgunter.4567 at gmail.com>
Cc: r-help at r-project.org; Calboli Federico (LUKE) <federico.calboli at luke.fi>
Subject: Re: [R] [Offlist] Windows standard interface: change working dorectory

[External Email]

My wife was a returning college student 10 years ago, and her stories to me of her upper division engineering students coping with files and Excel corroborate this deficiency. She was rather more computer-literate than average, but was still apprehensive about piling R on top of her engineering workload at that time. She later did a Master's and finally started using R and has expressed regret that she did not start using it sooner... but I meet engineers all the time who can barely use Excel much less a scripting language.

I suspect that ubiquitous GUI programs create a conceptual gap with text-based programming and hierarchical thinking. People are able to skim by all their lives without ever having to organize information.. just type in questions to Google... so why should they start now?
On December 11, 2025 6:37:59 PM PST, Bert Gunter <bgunter.4567 at gmail.com> wrote:
--
Sent from my phone. Please excuse my brevity.

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.r-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.