0% found this document useful (0 votes)
14 views20 pages

Unit - II Part-2

The document covers R programming structures, focusing on decision-making structures such as if, if-else, and switch statements. It also discusses various types of loops, including repeat, while, and for loops, along with control statements and the use of arithmetic and boolean operators. Additionally, it highlights tools for composing function code and the importance of the environment and scope in R programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views20 pages

Unit - II Part-2

The document covers R programming structures, focusing on decision-making structures such as if, if-else, and switch statements. It also discusses various types of loops, including repeat, while, and for loops, along with control statements and the use of arithmetic and boolean operators. Additionally, it highlights tools for composing function code and the importance of the environment and scope in R programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Data Science with R

Unit II: R PROGRAMMING STRUCTURES

M Narasimha Raju
Dept. of Computer Science & Engineering
Shri Vishnu Engineering College for Women (A),
Bhimavaram
⚫Decision making structures require the programmer to
specify one or more conditions to be evaluated or tested by
the program, along with a statement or statements to be
executed if the condition is determined to be true, and
optionally, other statements to be executed if the condition is
determined to be false.

2
if

3
R – If...Else Statement

4
The if...else if...else Statement

5
R – Switch Statement

6
7
Repeat Loop
⚫The Repeat loop executes the same code again and again until
a stop condition is met.

8
While Loop

9
For Loop

10
11
break

12
next

13
⚫7.1 Control Statements
⚫Loops

14
⚫if-else

15
7.
2

Arithmetic and Boolean Operators and Values

16
Return Values
⚫Functions Are Objects

17
Environment and Scope Issues
⚫The Top-Level Environment

⚫The Scope Hierarchy

18
Tools for Composing Function Code
⚫Text Editors and Integrated Development Environments
⚫We can use a text editor such as Vim, Emacs, or even Notepad,
or an editor within an integrated development environment
(IDE) to write your code in a file and then read it into R from the
file.
⚫The edit() Function
⚫R programmers do their code editing with a text editor in a
separate window, but for a small, quick change, the edit()
function can be handy.

19
Thank
You
M Narasimha Raju
Dept. of Computer Science & Engineering
Shri Vishnu Engineering College for Women (A),
Bhimavaram

You might also like