top of page

Getting started with R and RStudio

Updated: Oct 25, 2021

In this Blog we will discuss R and Rstudio. After that we will see how to use RStudio IDE for statistical analysis and data science.


What is R?


R is the programming language which is mainly used for statistical analysis, exploratory data analysis and graphical representation. R language was developed by Ross Ihaka and Robert Gentleman as an open source implementation of the “S” programming language.


Why R Language?


There are some reasons why we should use the R language.

  • It is free and open source compared to other software packages that can be 1000s dollars per year.

  • R language is optimized for vector operations which means you can go through an entire row or table of data without writing a for loop explicitly.

  • There are around 12000 contributed or third party packages available in open source repositories.

  • New libraries and tools are continuously added into their catalog.

  • It has a huge online support community.

  • R are state of the art in terms of programming language oriented towards data science.


What is RStudio?


RStudio is an integrated development environment (IDE), for R programming Language. Rstudio is the Best IDE available and user-friendly, open-source and is part of the Anaconda platform. It is mostly used for statistical analysis, graphics representation and data manipulation. Rstudio is available in two formats: Rstudio Desktop and Rstudio server. Rstudio Desktop is a regular desktop application and Rstudio server runs on a remote server and allows accessing Rstudio using a web browser. RStudio Desktop and Rstudio server both are free and free based commercial editions.


Some of its features :

  • Rustudio is designed in such a way that we can easily write scripts in it.

  • RStudio run on all major platform such Windows, Mac, Linux and it can also run as a server, enabling more than one users to access the Rstudio IDE using web browser

  • Execute the code directly from the source editor

  • Syntax highlighting editor with code completion

  • It has customizable workbench with all tools required to work with R in one place

Installation RStudio with Anaconda

We suggest installing Rstudio with an anaconda navigator because it manages all the libraries required for RStudio or R and it will install all required libraries and IDE into a single folder. else, you would need to install them separately.

  • First Install Anaconda

  • Install R

  • Install RStudio

When you start RStudio, you will see the following interface. There are four part of this IDE as you can see shown in the screenshot

Rstudio

Create new project

Goto file menu select New project. After clicking on it one pop dialog box will appear on your screen. You can Select the existing directory or create a new directory and at last click on create project. After creating the new project you are ready to write an R script.


Created New Project in RStudio

  • RScript

  • R Notebook

  • R Markdown

File menu in RStudio


What is R Script ?

R Script is a simple text file with extension with “.R” which contains a program / a set of commands. This is an interpreter of R which helps in the execution of R commands which are present in the R Script.

for createing a new R script goto file menu, choose new file and just click on RScript.


What is R Markdown ?


R Markdown is file format for making dynamic documents with R. It provides a framework for data science, code, its result and commentary. Hence it can compile R script to a notebook which includes source code, script output and commentary. R markdown is reproducible and it supports output formats such as, pdf, word files and many more.


To know more about R Markdown click here


What is R Notebook ?


“An R Notebook is an R Markdown document with chunks that can be executed independently and interactively, with output visible immediately beneath the input.”



R Notebook

Create a simple program in RScript to print a Statement “Welcome to Codersarts”.

RScript File

Save this code in a file with extension ".R".


Example of Code

myfirstString <- "Welcome to Codersarts"
print ( myfirstString)

In the above example we assign a string “Welcome to Codersarts” and then next statement print() is used to print the value in the variable string.


Output :

Simple program in R

How Codersarts can Help you in R programming ?


Codersarts provide:

  • R prograaming Assignment help

  • R programming Error Resolving Help

  • Mentorship in R programming from Experts

  • R programming Development Project

If you are looking for any kind of Help in R programming Contact us
bottom of page