Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Machine Learning with R Quick Start Guide

You're reading from   Machine Learning with R Quick Start Guide A beginner's guide to implementing machine learning techniques from scratch using R 3.5

Arrow left icon
Product type Paperback
Published in Mar 2019
Publisher Packt
ISBN-13 9781838644338
Length 250 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Iván Pastor Sanz Iván Pastor Sanz
Author Profile Icon Iván Pastor Sanz
Iván Pastor Sanz
Arrow right icon
View More author details
Toc

R and RStudio installation

Let's first start with installing R. It is totally free and can be downloaded from https://cloud.r-project.org/. Installing R is an easy task.

Let's look at the steps to install R on a Windows PC. For installing it on other operating systems, the steps are straightforward and are available at the same https://cloud.r-project.org/ link.

Let's start by installing R on a Windows system:

  1. Visit https://cloud.r-project.org/.
  2. Look for Download and Install R and select your operating system. We are installing for Windows, so select the Windows link.
  3. Go to Subdirectories and click on base.
  4. You will be redirected to a page that shows download R X.X.X for Windows. At the time of writing this book, Download R 3.5.2 for Windows is the version that you need to click on.
  5. Save and run the .exe file.
  6. You can now select the setup language to install R.
  7. A setup wizard will open and you can go on clicking Next until you reach Select Destination Location.
  8. Select your preferred location and click Next.
  9. Click the Next button several more times until R starts to install.
  10. After the installation is complete, R will notify you with the message Completing the R for Windows 3.5.2 Setup Wizard. You can now click on Finish.
  11. You can find the R shortcut on your desktop and double-click on it to start R.
  12. Like any other application, in case you can't find R on your desktop, you can go to the Start button, All Programs, and look for R and start it.
  13. You will get a screen similar to what's shown in the following screenshot:

This is the R Command Prompt, waiting for input.

Things to know about R

Before moving on to typing in commands, you must know that R is a case-sensitive and interpreted language.

You can choose between manually entering commands and running a set of commands from the source file as per your will. R provides a lot of built-in functions that give most functionalities to the user. As a user, you can even create user-created functions.

You can even create and manipulate objects. You might know that objects are anything that can have an assigned value. An interactive session will require all objects to be present in the memory while the execution process is running, whereas the functions can be placed in the packages that have a reference in the current program and can be accessed as and when needed.

Using RStudio

Alongside using R, it is recommended to use RStudio. RStudio is an integrated development environment (IDE) that, like any other IDE, enhances your interaction with R.

RStudio provides you with a very well-organized interface that can clearly represent graphs, data tables, R code, and output simultaneously.

Moreover, to import and export files in different formats into R without having to write code, R offers an import wizard like feature.

Having seen the standard R GUI interface, you will see the similarities with RStudio, but the difference is that RStudio is very intuitive and user-friendly compared to the R GUI. You will have many options to choose from the menu, and you can even customize the GUI according to your requirements. RStudio for desktop is available at https://www.rstudio.com/products/rstudio/download/#download.

RStudio installation

The installation steps are very similar to the installation of R, so it isn't necessary to describe the detailed steps.

The first time you open RStudio, you will see three different windows. You can enable a fourth window by going to File, New File, and selecting R Script:

On the upper-left side window, scripts can be written and then saved and executed. The window that follows, on the left, represents the Console, where codes in R can directly be executed.

The upper-right window allows for the visualization of variables and objects that have been defined in the workspace. Furthermore, it is possible to see the history of commands that were previously executed. Finally, the bottom-right window displays the working directory.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime