Author: David Zelený
Author: David Zelený
For semester 109-1: make sure that you have the latest version of R and RStudion installed on your computers:
Note that first you need to install (or update) R on your computer (this is where all commands are processed), and then you install RStudio (this is just an editor, a wrapper around R). RStudio without R does not work.
Donwload R for Windows), and then choose either
Install R for the first timeif you haven't install R before you your computer, or
baseif you already did and you are installing a new version; download the installation file and proceed further). If you are using Mac, you may need to Google some help (eg see this website for help).
If you have R already installed on your computer and you want to update to newer version, the easiest way is simply to install the new version along the old one (and later possibly delete the old one if you don't need it or you want to save space on hard drive). All R versions are, if not changed, installed beside each other in R subfolder of Program Files folder (in the case of Windows). You may need to install also all the packages you used in the previous version. You can simply copy the folder
library from the old R version to new R version and run an update procedure in new R version using the command
update.packages. For this, do the following:
libraryfolder with R libraries from the previous version. This is usually located in c:\Program Files\R\R-x.x.x\library, where R-x.x.x is the number of the previous R version, e.g. R-3.1.2. In some cases it could, however, be somewhere else; if not sure, open R, and type
.libPaths ()to see location of library path on your computer.
libraryfolder of the new version. Do not overwrite the newer versions of files in the
libraryfolder of the new R version.
update.packages(ask = F)2). This should update all the packages to their latest version compatible with current version of R.
Download the latest version from RStudio website; you will need Desktop version, Open Source Edition for your system; you may click here to get directly to the selection of actual RStudion version. Follow instructions for installation. If you already have RStudio installed in your computer, please check whether you have the latest version and update if you don't (in RStudio menu, go to Help > Check for Updates).
RStudio is a convenient software, which combines R program with text editor and graphical user interface (and offers much more, like organization of scripts and outputs into a projects within single folder, and for advanced users also convenient building of packages, document markup etc.). One thing I found a bit not handy is RStudio's native graphical output - it offers its own unique sizeable graphical output into one of the subpanels (usually the bottom-right one), but it sometimes produces troubles (especially in case when you draw more complex figures). The workaround is to open the original R drawing panel - just type
windows () into the console, and new active window will open (you can move it around the screen, or right-click on it by mouse and select “Stay on top” to keep it as the top window always visible on your screen).
Optionally, there is a number of other text editors, which can be associated with R, e.g. Tinn-R. You are free to use the editor of your choice. In the class, I will use RStudio.
ask = Fin the function
update.packagesmakes sure that the update function will not ask you to prompt updating each package separately.