Kovaipudur , Coimbatore-641402
Affiliation No:
1930510
PRACTICAL FILE
for
Class XI Data Science
Practical Examination 2024
[As a part of the Data Science Course (844)]
Submitted by:
[Link]
[Reg No. ___________]
Under the Guidance of:
Akhila.B
PGT (Csc)
CERTIFICATE
Certified that this is the bonafide record of
the practical work in Data Science done by
[Link] (Reg No: ____________) and is
submitted for the Practical Examination at
CS Academy, Coimbatore on
_____________________.
……….…………………
Signature of Principal
(Mr. Neil Guha)
…………………………………
Signature of Internal Examiner
INDEX
[Link] TOPIC [Link]
1. Current working directory 1
2. Single-element vectors of different data types 2
3. Multiple-element vector 3
4. Arithmetic operations of two vectors 4
5. Named list with different types 5
6. Named list with names of 5 cities in India, 2 integers, and 6
2 float values
7. Named list with a sequence of numbers divisible by 3 from 7
30 to 40 and a vector containing colours
8. Merging two lists 8
9. Converting list to vector 9
10. Creating two 3 by 3 matrices 10
11. Creating two 2 x 2 matrices and performing the various 11
arithmetic operations
12. Creating a matrix with elements arranged sequentially by 12
column
13. Creating a matrix with elements arranged sequentially by 13
row
14. Named 2 by 2 matrix 14
15. Two 3 by 3 matrices where matrix 1 has all numbers 15
increasing by 5
16. Data frame with 6 records 16
17. Data frame with 8 records 17
18. Scatter plot for two variables 18
19. Line chart to depict age vs height 19
20. Line chart showing a company’s sales performance 20
21. Bar chart that depicts the temperature over 6 months 21
22. Population of states in a pie chart 22
23. Box plot 23
CURRENT WORKING
DIRECTORY
Ex.1
AIM:
To print the working directory using getwd()
CODING:
> getwd()
OUTPUT:
RESULT:
The above code was executed and the output has been
obtained
SINGLE ELEMENT VECTOR OF DIFFERENT TYPES
Ex.2
AIM:
To print single element vectors of different data types.
CODING:
> print(“Science”)
> print(56)
> print(57.9)
> print(FALSE)
OUTPUT:
RESULT:
The above program has been executed successful
MULTIPLE ELEMENT VECTOR
Ex.3
AIM:
To create a multiple element vector and print it.
CODING:
> V = 2.2:8.2
> Y = seq(7,11,by=0.5)
> Z = c(‘mango’,’indigo’,6,FALSE)
> p = c(1.5:2.5,10,”next”)
> print(V)
> print(Y)
>print(Z)
>print(p)
OUTPUT:
RESULT:
The above program has been executed successfully.
ARITHMETIC OPERATIONS OF TWO VECTORS
Ex.4
AIM:
To perform arithmetic operations on two vectors.
CODING:
> x = 10
> y = 20
> c = x+y
> d = x*y
> e = x/y
> print(c)
> print(d)
> print(e)
OUTPUT:
RESULT:
The above program has been executed successfully
LIST WITH DIFFERENT DATA TYPES
Ex.5
AIM:
To create a list containing different types and name them.
CODING:
> x = list(1023,”Percy Jackson”,”250d”,2500,TRUE)
> names(x)=c(“Shelf number”,”Author”,”Bookid”,”Price”,”Condition”)
> print(x)
OUTPUT:
RESULT:
The above program has been executed successfully
NAMED LIST WITH NAMES OF 5 CITIES IN INDIA, 2
INTEGERS AND 2 FLOAT VALUES
Ex.6
AIM:
To create a list containing names of 5 cities in India, 2 integers, and 2
float values and name them.
CODING:
>v=list("Coimbatore","Pune","Chennai","Jaipur","Erode",21.2,4.3,"TRUE)
> print(v)
OUTPUT:
RESULT:
The above program has been executed successfully
NAMED LIST WITH A SEQUENCE OF NUMBERS DIVISIBLE
BY 3 FROM 30 TO 40 AND A VECTOR CONTAINING
COLOURS
Ex.7
AIM:
To create a list containing a sequence of numbers divisible by 3 from
30 to 40 and a vector containing colours.
PROGRAM CODING:
> X = list(seq(30,40,by=3),seq(3,40,by=3),c(“Indigo”,”Blue”))
> names(X) = c(“Sequence of numbers divisible by 3 from 30 to 40”,
“Sequence of numbers divisible by 3 from 30 to 40”,”Colours”)
> print(X)
OUTPUT
RESULT:
The above program has been executed successfully
MERGING TWO LISTS
Ex.8
AIM:
To create two lists and merge them.
PROGRAM CODING:
> L1 = list(10,20,30,40)
> L2 = list(20,40,”hello”)
> L3 = c(L1,L2)
> Print(L3)
OUTPUT:
RESULT:
The above program has been executed successfully
CONVERTING LIST TO A
VECTOR
Ex.9
AIM:
To create a list ,convert it into a vector and
print the vector.
PROGRAM CODING:
>list1=c(2,4,6)
>list2=c(1,3,5)
>list3=c(list1,list2)
>list4=unlist(list1)
> print(list4)
OUTPUT:
RESULT:
The above program has been executed successfully
CREATING TWO 3 BY 3 MATRICES
Ex.10
AIM:
To create a two 3 by 3 matrices and enter the data
PROGRAM CODING:
> X = matrix(c(1:9),3,3)
> Y = matrix(c(10:18),3,3)
> print(X)
> print(Y)
OUTPUT:
RESULT:
The above program has been executed successfully
CREATING TWO 2X2 MATRICES AND PERFORMING
VARIOUS ARITHMETIC OPERATIONS
Ex.11
AIM:
To create two 2 x 2 matrices and perform the various arithmetic
operations.
PROGRAM CODING:
> X = matrix(c(1:9),3,3)
> Y = matrix(c(10:18),3,3)
> C = X+Y
> V = X-Y
> Z = X*Y
> R = Y/X
> print(C)
> print(V)
> print(Z)
> print(R)
OUTPUT:
RESULT:
The above program has been executed successfully
CREATING A MATRIX WITH ELEMENTS ARRANGED
SEQUENTIALLY BY COLUMN
Ex.12
AIM:
To create a matrix with elements arranged sequentially by column.
PROGRAM CODING:
> Matrix = (c(1:8),2,4,byrow=FALSE)
> print(Matrix)
OUTPUT:
RESULT:
The above program has been executed successfully
CREATING A MATRIX WITH ELEMENTS ARRANGED
SEQUENTIALLY BY ROW
Ex.13
AIM:
To create a matrix with elements arranged sequentially by row.
PROGRAM CODING:
> Matrix = (c(1:8),2,4,byrow=TRUE)
> print(Matrix)
OUTPUT:
RESULT:
The above program has been executed successfully
NAMED 2 BY 2 MATRIX
Ex.14
AIM:
To create a matrix that is of size 2 by 2 with names
PROGRAM CODING:
> Matrix=(c(1:4),2,2)
> rownames(Matrix)=c(“Row 1”,”Row 2”)
> colnames(Matrix)=c(“Col 1”,”Col 2”)
> print(Matrix)
OUTPUT:
RESULT:
The above program has been executed successfully
TWO 3 BY 3 MATRICES WHERE MATRIX 1 HAS ALL
NUMBERS INCREASING BY 5
Ex.15
AIM:
To read two 3 by 3 matrices where matrix 1 has all numbers
increasing by 5.
PROGRAM CODING:
> Matrix1 = matrix(seq(5,45,by=5),3,3)
> print(Matrix1)
> Matrix2 = matrix(c(1:9),3,3)
> print(Matrix2)
OUTPUT:
RESULT:
The above program has been executed successfully
DATA FRAME WITH 6 RECORDS
Ex.16
AIM:
To create a data frame with 6 records containing details of Book ID,
Book Title, Book Author, Price. Print the data frame,structure and its
summary.
PROGRAM CODING:
> books= [Link](Id = 1:6,Title = c("R Programming", "Data
Science", "Machine Learning", "Deep Learning", "Python Programming",
"AI Fundamentals"),Author = c("John Smith", "Jane Doe", "Alan Turing",
"Yann LeCun", "Guido van Rossum", "Andrew Ng"),Price = c(29.99, 35.50,
45.00, 50.75, 40.00, 55.20))
> print(books)
> str(books)
> summary(books)
OUTPUT:
RESULT:
The above program has been executed successfully
DATA FRAME WITH 8 RECORDS
Ex.17
AIM:
Create a data frame with 8 records containing details about
employee ID, employee name, designation, department, and salary. Print
the data frame, its structure, and the summary.
PROGRAM CODING:
> Employee = [Link](ID = 101:108,Name = c("Rithi", "Sai", "Dheek",
"Thans", "Reems", "Prags", "Shivs", "Pranavi"), Designation =
c("Manager", "Developer", "Analyst", "HR", "Developer", "Manager",
"Analyst", "HR"),Department = c("Sales", "IT", "Finance", "HR", "IT",
"Sales", "Finance", "HR"),Salary = c(60000, 45000, 50000, 55000, 47000,
65000, 51000,53000))
> print(Employee)
>str(Employee)
> summary(Employee)
OUTPUT:
RESULT:
The above program has been executed successfully
SCATTER PLOT FOR 2 VARIABLES
Ex.18
AIM:
To plot a scatter plot for two variables using R.
PROGRAM CODING:
> x=c(6:10)
> y=c(1:5)
> s=plot(x,y,xlab="variable x",ylab="variable y")
OUTPUT:
RESULT:
The above program has been executed successfully
LINE CHART TO DEPICT AGE VS HEIGHT
Ex.19
AIM:
To plot a line chart to depict age vs height.
PROGRAM CODING:
> age = c(20,25,30,35)
> height = (155,165,175,185)
>s=plot(age,height,type="o",xlab="age",ylab="height",col="Black",main
="age and height")
OUTPUT:
RESULT:
The above program has been executed successfully
LINE CHART SHOWING A COMPANY’S
PERFORMANCE
Ex.20
AIM:
To plot a line chart showing a company’s sales performance.
PROGRAM CODING:
> months=c("jan","feb","march","apr")
> sale=c(1000,2500,5000,3750)
> months_s=factor(months,level=months)
>s=plot(months_s,sale,type="p",xlab="month",ylab="sales",main="mont
h and sales")
OUTPUT:
RESULT:
The above program has been executed successfully.
BAR CHART THAT DEPICTS THE TEMPERATURE OVER
SIX MONTHS
Ex.21
AIM:
To plot a bar chart that depicts the temperature over 6 months.
PROGRAM CODING:
> months=c("jan","feb","mar","apr","may","june")
> temp=c(21,22,27,29,31,30)
>s=barplot([Link]=months,temp,xlab="month",ylab="temperature",
main="months and temperature")
OUTPUT:
RESULT:
The above program has been executed successfully
POPULATION OF STATES IN A PIE CHART
Ex.22
AIM:
To Show the population of states using a pie chart.
PROGRAM CODING:
> x=c("Uttar Pradesh","Maharashtra","Madhya
Pradesh","Assam","Bihar")
>y=c(50000,40000,25000,15000,37000)
>pie(y,x)
OUTPUT:
RESULT:
The above program has been executed successfully
BOXPLOT
Ex.23
AIM:
Plot a boxplot for any data.
PROGRAM CODING:
> boxplot(Temp~Month,data=air quality,main="Different boxplots for
each month",xlab="Month Number",ylab="Degree
Fahrenheit",col="orange", border="brown")
OUTPUT:
RESULT:
The above program has been executed successfully