0% found this document useful (0 votes)
2 views2 pages

R Programming Basics: Complete Guide

Uploaded by

lahariyadav247
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)
2 views2 pages

R Programming Basics: Complete Guide

Uploaded by

lahariyadav247
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

UNIT – I : R Programming Basics – Complete Notes

1. Introduction to R

• R is a free, open-source programming language used for statistics, data analysis, visualization,
and machine learning.

• Developed by Ross Ihaka and Robert Gentleman.

2. How to Run R

a) R Console – Direct command execution.

b) RStudio – Provides editor, environment window, and plots panel.

3. R Sessions

• Session starts when R is opened and ends when closed.

• [Link]() saves workspace.

• load(".RData") loads workspace.

4. Functions in R

• Functions perform tasks.

Example: sum(10, 20)

User-defined:

add <- function(a, b){

a+b

5. Basic Mathematics in R

+ Addition | - Subtraction | * Multiplication | / Division | ^ Power | %% Modulus

6. Variables

• Used to store values.

Examples:

x <- 10

name <- "Lav"

7. Data Types

• Numeric, Integer, Character, Logical, Complex


8. Vectors

• One-dimensional collection of same data type.

num <- c(1,2,3)

Operations: num + 2, num * 3

9. Advanced Data Structures

a) Lists – list(10, "Lav", TRUE)

b) Matrices – matrix(1:6, nrow=2)

c) Arrays – array(1:12, dim=c(3,2,2))

d) Data Frames – [Link](Name=c("A","B"), Age=c(20,22))

10. Classes

• class(x) tells the class/type of an object.

You might also like