Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 11

UNIVERSITY INSTITUTE OF

ENGINEERING
COMPUTER SCIENCE ENGINEERING

Bachelor of Engineering (Computer Science &


Engineering)
Subject Name: STATISTICAL METHODS USING R
Subject Code: 20SMT-460
Introduction to R
1. Installing R and RStudio:

R Installation:
 Download R from the official R Project website (
https://www.r-project.org/).
 Follow the installation instructions based on your
operating system (Windows, macOS, or Linux).
RStudio Installation:

 Download RStudio from the official RStudio website (


https://www.rstudio.com/).
 Follow the installation instructions.
 RStudio provides a user-friendly interface for working
with R.
2. Basic R Syntax and Data Types:

R as a Calculator:

 Use R for basic arithmetic operations.


 Example:

# Addition
2+3

# Subtraction
5-1
# Multiplication
4*2

# Division
10 / 2
Variables and Assignment:

 Assign values to variables using <- or =.


 Example:

# Variable assignment
x <- 5
y=3

# Use variables in calculations


z <- x + y
Data Types:

Different forms of data that can be saved and manipulated


are defined and categorized using data types in computer
languages, including R. Each R data type has unique
properties and associated operations.
What are R Data types?

 R Data types are used in computer programming to specify


the kind of data that can be stored in a variable. For
effective memory consumption and precise computation,
the right data type must be selected. Each R data type has
its own set of regulations and restrictions.
 Data Types in R Programming Language
 Each variable in R has an associated data type. Each R-Data
Type requires different amounts of memory and has some
specific operations which can be performed over it.
R Programming language has the following basic R-data
types and the following table shows the data type and the
values that each data type can take.
Basic Data Types Values Examples

Numeric Set of all real numbers "numeric_value <- 3.14"

Integer Set of all integers, Z "integer_value <- 42L"

Logical TRUE and FALSE "logical_value <- TRUE"

Complex Set of complex numbers "complex_value <- 1 + 2i"

“a”, “b”, “c”, …, “@”, “#”, “$”, "character_value <- "Hello


Character …., “1”, “2”, …etc Geeks"

"single_raw <-
raw as.raw() as.raw(255)"
https://youtu.be/_V8eKsto3Ug?feature=shared

You might also like