Calboli Federico (LUKE)
2025-Dec-08 11:22 UTC
[R] Windows standard interface: change working dorectory
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 [[alternative HTML version deleted]]
Michael Dewey
2025-Dec-08 12:22 UTC
[R] Windows standard interface: change working dorectory
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:> 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 > > [[alternative HTML version deleted]] > > > ______________________________________________ > 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.-- Michael Dewey
Ebert,Timothy Aaron
2025-Dec-08 14:15 UTC
[R] Windows standard interface: change working dorectory
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
[[alternative HTML version deleted]]
Robert Baer
2025-Dec-12 00:54 UTC
[R] Windows standard interface: change working dorectory
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:> 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 > > [[alternative HTML version deleted]] > > > ______________________________________________ > 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.-- --- Robert W. Baer, Ph.D. Professor of Physiology Kirksville College of Osteopathic Medicine A.T. Still Univerisity of Health Sciences 800 W. Jefferson St. Kirksville, MO 63501