One difficulty that I had to address during the writing stage is the difference between PCs running on Windows and Macs running on Mac OS with respect to pathnames. Throughout the book, you will have to provide the path to some working files (datasets, for instance).
A pathname (also known as a path) is the location where a computer file or any other object is located. Suppose that the text file <myfile.txt> is located in a folder named <mysubfolder>, which is itself located inside another folder named <myfolder>, which is itself located at the root of your hard drive (on Mac OS, the root folder is called Macintosh HD and is simply named
/, whereas on Windows, it is
C:). To access the text file, you provide its full path.
On a Mac, the full path is likely to be the following:
On a PC running on Windows, the path is likely to be the following:
In the book, I have adopted the above conventions. In practice, however, due to the variety of computer configurations, this might not work for all Windows users.
If, as a Windows user, you encounter an issue, convert the single slash to a pair of backslashes whenever you have to enter a file path, like so:
To save you the trouble of switching from slashes to double backslashes manually, I have made the changes myself in the companion code files (not in the book).
On several occasions in the book, I write pathnames « the Mac way », i.e. without the Windows equivalent. I have done this for reasons of space, and also because I work on a Mac and sometimes forget that most users work with a PC. In the companion code files, I have systematically added the Windows convention.
If you think that entering pathnames is tedious, you can still use
file.choose(), which will prompt R to open an interactive window from which you can select the desired file.