Professional Documents
Culture Documents
3
R Data Types
Represents complex
Complex 2 + 3i, -1 - 0.5i
numbers
Represents raw
Raw as.raw(1:5)
bytes
4
R Data Structures
A two-dimensional array
with rows and columns,
Matrix matrix(1:6, nrow = 2)
containing elements of
the same data type.
A multi-dimensional
extension of matrices,
Array array(1:8, dim = c(2, 2, 2))
containing elements of
the same data type.
5
Data Structure Description Example
A flexible container that
can hold elements of
list(name = "John", age =
List different data types,
30)
including other data
structures.
A two-dimensional, table-
data.frame(Name =
like structure for storing
Data Frame c("Alice", "Bob"), Age =
data, where columns can
c(25, 30))
be of different data types.
6
Importing Data To R
7
Exporting Data To R
8
Control Structures in R
1) If
2) If-else 1) For 1) Break
3) If-else 2) While 2) Next 1) return
if-else 3) repeat
9
SUMMARY
Control Structure Description Example
Executes a block of
if (condition) { # Code
if code if a condition is
to execute }
TRUE.
Executes one block of
if (condition) { # Code
code if a condition is
if-else for TRUE } else { # Code
TRUE and another if it's
for FALSE }
FALSE.
if (condition1) { # Code
for condition1 } else if
Allows for multiple
(condition2) { # Code
if-else if-else conditions to be tested
for condition2 } else { #
in sequence.
Code if no condition is
met }
for (variable in
Iterates over a
for sequence) { # Code to
sequence of values.
execute }
10
Control Structure Description Example
Repeatedly executes a
while (condition) { #
while block of code as long as a
Code to execute }
condition is TRUE.
repeat { # Code to
Repeatedly executes a
execute if condition is
block of code until
repeat TRUE break # Exit the
explicitly stopped using
loop when a condition is
break.
met }
for (i in 1:10) { if (i == 5) {
break Exits a loop prematurely. break } # Exit loop when i
equals 5 }
11
Control Structure Description Example
for (i in 1:5) { if (i == 3)
Skips the current { next } # Skip iteration
next iteration and moves to when i equals 3 # Code
the next one in a loop. to execute for other
iterations }
my_function <-
function(x) { if (x > 10) {
Exits a function and return("Greater than
return
returns a value. 10") } else {
return("Less than or
equal to 10") } }
12
DESCRIPTIVE STATISTICS
13
Data Exploration
14
Qualitative & Quantitative Data
15
MEASUREMENT of CENTRAL TENDENCY
16
Measure of Position
Generalization of
Quintiles, Septiles,
Quantiles quartiles, deciles, and
Noniles, etc.
percentiles.
17
Measure of Dispersion
18
THANK YOU