0% found this document useful (0 votes)
23 views19 pages

RCourse-Lecture5-Introduction-Introduction To R Studio - Watermark

This document provides an introduction to R Studio, which is an interface that makes coding in R easier. It describes the four windows in R Studio: 1) the script editor window for writing code, 2) the console for running code and seeing output, 3) the environment window showing variables, and 4) the output window displaying results. It also explains how to install R Studio, use scripts versus the command line, edit data frames, load packages, and get help. Basic functions like library and barplots are demonstrated.

Uploaded by

kavithanjali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views19 pages

RCourse-Lecture5-Introduction-Introduction To R Studio - Watermark

This document provides an introduction to R Studio, which is an interface that makes coding in R easier. It describes the four windows in R Studio: 1) the script editor window for writing code, 2) the console for running code and seeing output, 3) the environment window showing variables, and 4) the output window displaying results. It also explains how to install R Studio, use scripts versus the command line, edit data frames, load packages, and get help. Basic functions like library and barplots are demonstrated.

Uploaded by

kavithanjali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Foundations of R Software

Lecture 5
Introduction
::::
Introduction to R Studio

Shalabh
Department of Mathematics and Statistics
Indian Institute of Technology Kanpur

1
Installing R Studio

Click on Download.

2
Installing R Studio

Download and double click on the downloaded file.

3
Command Line versus Scripts
Use R Studio software.

4
Command Line versus Scripts
Suppose we want to use following three functions:

Type them.
library(MASS)
attach(bacteria)
fix(bacteria)

Suppose we want to run only function: library(MASS)

Highlight it and click on Run

Then we get….
5
Command Line versus Scripts

6
Data Editor
There is a data editor within R that can be accessed from the
menu bar by selecting Edit/Data editor.

Provide the name of the matrix or data frame that we want to


edit and a Data Editor window appears.

Alternatively we can do this from the command line using the


fix function.
Example:
library(MASS)
attach(bacteria)
fix(bacteria) 7
Data Editor
We can do it in R Studio as follows :

8
Introduction to R Studio

It is an interface between R and us.

More useful for beginners.

It makes coding easier.

When we start R studio, we see 4 windows

9
Introduction to R Studio
First opening window of Rstudio is as follows having four
windows.

10
Introduction to R Studio
Description of Window 1

11
Introduction to R Studio
Description of Window 1

12
Introduction to R Studio
Description of Window 2 : Console
R program window appears here.

Calculations take place inconsole window.

One can write programmes in console also but it is hard to make


corrections and experiments with the coding.

13
Introduction to R Studio
Description of Window 3 : Environment window

All the variables and objects used in the programme appear here.
The nature and values of variables and objects also appear here.

14
Introduction to R Studio
Description of Window 4 : Output window

The output of programmes appears in this window.

15
Introduction to R Studio
Description of Window 4 : Output window

Packages:

All the packages being installed appear here.

Packages are not


active.

Check mark in the


boxes to activate
them.

16
Introduction to R Studio
Window 4 : Output window

Help:

Various types of help can be asked.

E.g., to know about


histogram,
type hist.

Information appears.

17
Introduction to R Studio

Example:

Bar diagram of values 1,2,1,1,2,3,1,2,3,1,2,2,3

R studio has following operation and output:

18
Introduction to R Studio

Example:

Bar diagram of values


x = c(1,2,1,1,2,3,1,2,3,1,2,2,3)
barplot(table(x))

R studio has following operation and output:

19

You might also like