This is the third and last post in the Installing R and RStudio series, where I will describe the installation of R and RStudio on Windows 10.
Same as before, I will be installing the latest version of R (currently 4.0) and RStudio (1.2.5042) on a virtual machine with a clean and up-to-date version of Windows 10 (10.0.18363).
For a short introduction to R and also RStudio, please check the first post in this series.
The Windows installation process is the simplest. You can go directly to the CRAN website that contains the R Windows base installer https://cran.r-project.org/bin/windows/base/ and download the installation file.
Note: You might have noticed that my Windows Taskbar is on the left side and not on the bottom. Today, the screens of most monitors is wide and I prefer to have the extra height and decided to have my taskbar on the left.
Now you just run the installer. I suggest you just install using the default settings and you should be fine. Some options, such as selecting the GUI preferences (MDI or SDI), can be changed later via R Console.
GUI preference: MDI vs SDI
MDI stands for Multiple Document Interface. It is an interface design for handling documents within a single application. When application consists of an MDI parent form containing all other window consisted of the app, then MDI interface can be used. Switch focus to a specific document can be easily handled in MDI. For maximizing all documents, parent window is maximized by MDI
SDI stands for Single Document Interface. It is an interface design for handling documents within a single application. SDI exists independently from others and thus is a stand-alone window. SDI supports one interface means you can handle only one application at a time. For grouping, SDI uses special window managers
In the screenshot gallery below, you can see the difference between SDI and MDI. The last screenshot it the gallery shows how to switch between MDI and SDI. In my opinion, the way it is done is strange. The steps are:
For me, this is strange, as I assumed that by pressing just OK, the configuration would be saved.
As also mentioned in previous posts, you will probably install a few packages to use with R (e.g. dplyr, ggplot2, Shiny, etc.), and while attempting, you will see the question “Would you like to use a personal library instead?".
You can simply click on Yes to create a personal library or run R Console as Administrator. Installing as Administrator has the advantage that other users using the same computer can use the same packages already installed, instead of having to install them as well.
To run R Console as Administrator (as long as you have the rights), just right-click on the R Console icon (R i386 4.0.0 or R x64 4.0.0), click on More and click on Run as administrator.
Running R Console as administrator (elevated) allows you to install the packages and be stored in Program Files in the R library folder.
As mentioned in two previous posts, some packages may have other dependencies. For example, the package xlsx requires Java and you will encounter an error if you try to load this package without having Java installed.
> library('xlsx') Error: package or namespace load failed for ‘xlsx’: .onLoad failed in loadNamespace() for 'rJava', details: call: fun(libname, pkgname) error: JAVA_HOME cannot be determined from the Registry
Java SE Development Kit 14 (current version at time of writting) can be downloaded from: https://www.oracle.com/java/technologies/javase-jdk14-downloads.html.
After installation, it will load without errors (the second attempt, which was successfull, was made after installing Java JDK).
One last suggestion is to setup the R path in the Windows 10 Environment Variables so you can use it via command prompt.
Unlike macOS and Linux, if you try to run R from the Windows Command Prompt, it will inform that R is not recognized.
Follow the steps below to add R to the Windows path in the System Properties Environment Variables.
You can now open a Command Prompt and use R. If you have an open Command Prompt, you must close it first.
On Windows, RStudio is also the best choice for developing with R.
The installation of RStudio on Windows is also very simple. Visit the RStudio Desktop (Open Source License) download website at https://RStudio.com/products/RStudio/download/#download, download the installer and run it.
Just follow the instructions and the installation should be complete in less than a minute. There is no settings to be made during the installation.
Installing R and RStudio on Windows is also easy, but feel free to contact me if you have any problems and need help installing it.