Data Analytics Lab File Rohit
Data Analytics Lab File Rohit
LAB FILE
S.No Contents
1. Institute Vision and Mission
2. Department Vision, Mission and PEO
3. Program Outcomes and Program Specific Outcomes.
PSO 1: Use and apply current technical concepts and practices in the core
Information Technologies of Human Machine Learning, Information Management,
Programming, Cloud Computing.
PSO 2: Design, develop and test software systems for worldwide network of
computers to provide solutions to real world problems.
Computer Lab DO’s and DON’T
Do’s
1. Know the location of the fire extinguisher and the first aid box and how to use them in case of an
emergency.
2. Read and understand how to carry out an activity thoroughly before coming to the laboratory.
3. Report fires or accidents to your lecturer/laboratory technician immediately.
4. Report any broken plugs or exposed electrical wires to your lecturer/laboratory technician
immediately.
Don’ts
1. Do not eat or drink in the laboratory.
3. Do not open the system unit casing or monitor casing particularly when the power is turned on.
Some internal components hold electric voltages of up to 30000 volts, which can be fatal.
4. Do not insert metal objects such as clips, pins and needles into the computer casings. They may
cause fire.
6. Do not touch, connect or disconnect any plug or cable without your lecturer/laboratory
technician’s permission.
Course outcomes
CO-2 Apply data preprocessing and dimensionality reduction methods on raw data
CO-4 Execute clustering and association rule mining algorithms on different datasets
CO-5 Implement and evaluate the performance of KNN algorithm on different datasets
INDEX
Assessment Criterion Sign.
Experiment Experiment
S.No Practical’s Name COs
Performance Result
(5) (5) Viva Record
(5) (5)
1. To get the input from user and CO1
perform numerical operations
(MAX, MIN, AVG, SUM,
SQRT, ROUND) using in R.
2. To perform data CO2
import/export (.CSV, .XLS,
.TXT) operations using data
frames in R.
3. To get the input matrix from CO1
user and perform Matrix
addition, subtraction,
multiplication, inverse
transpose and division
operations using vector
concept in R.
4. To perform CO1
statistical operations
(Mean, Median, Mode and
Standard deviation) using R.
5. To perform data CO2
preprocessing operations i)
Handling Missing data ii)
Min-Max normalization
Course Name : Data Analytics Lab EXPERIMENT NO. 1
OBJECTIVE: To get the input from user and perform numerical operations (MAX,
MIN,AVG,SUM,SQRT,ROUND) using R.
CODE:
>x<- c(3.5,2.87,3.14,0.99,7.12,9.11)
OUTPUT:
Course Name : Data Analytics Lab EXPERIMENT NO. 2
>df=data.frame("NAME"=c("KRATOS","FAYE","FREYA"),"LANGUAGE"=c("JAVA","PYTHON","R"),"
AGE"=c(21,20,19))
> print(df)
>newDF=rbind(df,data.frame(NAME="ODIN",LANGUAGE="RUBY",AGE="23"))
> print(newDF)
>df=data.frame("NAME"=c("KRATOS","FAYE","FREYA"),"LANGUAGE"=c("JAVA","PYTHON","R"),"
AGE"=c(21,20,19))
> print(df)
>newDf=cbind(df,"RANK"=c("3","5","1"))
> print(newDf)
OUTPUT:
Initial Data frame:
Data frame after adding a ROW:
OBJECTIVE: To get the input matrix from user and perform Matrix addition, subtraction,
multiplication, inverse transpose and division operations using vector concept in R.
CODE:
>#create two 2*3 matrixes
>m1 = matrix(c(1 , 2 , 3 , 4 , 5 , 6),nrow=2)
>print("Matrix-1:")
[1] "Matrix-1:"
>print(m1)
>print("Matrix-2:")
[1] "Matrix-2:"
>print(m2)
>result = m1 + m2
>print("Result of addition")
>result = m1 - m2
>print("Result of substraction")
>print(result)
>result = m1 * m2
>print("Result of multiplication")
>print(result)
>print("Result of division")
>print(result)
Matrix 2:
Result of ADDITION:
Result of SUBSTRACTION:
Result of MULTIPLICATION:
Result of DIVISION:
Course Name : Data Analytics Lab EXPERIMENT NO. 4
OBJECTIVE: To perform statistical operations (Mean, Median, Mode and Standard deviation)
using R.
Mean: Calculate sum of all the values and divide it with the total number of values in the dataset.
Mode: The most occurring number in the dataset. For calculating mode, there is no default function in
R. So, we have to create our own custom function.
Standard Deviation: A measure that is used to quantify the amount of variation or dispersion of a set
of data values.
CODE:
Mean
>x <- c(1,2,3,4,5,1,2,3,1,2,4,5,2,3,1,1,2,3,5,6)#dataset
>mean.result= mean(x)
>print(mean.result)
[1] 2.8
Median
>median.result= median(x)
>print(median.result)
[1] 2.5
Mode
+ ux[which.max(tabulate(match(x,ux)))]
+}
>mode.result = mode(x)
>print(mode.result)
[1] 1
Standard Deviation
>sd.result = sqrt(var(x))
>print(sd.result)
[1] 1.576138
Course Name : Data Analytics Lab EXPERIMENT NO. 5
Step1:
Create Data Frame
Let us first create data frame with some missing values and then demonstrate with an example how to find the
missing values
>print(data)
Step2:
Now to check the missing values we are using is.na() function in R and print out the number of missing items
in the data frame as shown below.
Syntax: is.na()
Parameter: x:dataframe
Example1:
In this example, we have first created data with some missing values and then found the missing value in
particular columns x1,×2,x3, and x4 respectively using the above function
CODE:
>data <- data.frame(x1= c(NA,5,6,8,9),x2= c(2,4,NA,NA,1),x3= c(3,6,7,0,3),x4=
c("Hello","value",NA,"BBDITM",NA))
>which(is.na(data$x1))
[1] 1
>which(is.na(data$x2))
[1] 3 4
>which(is.na(data$x3)) integer(0)
>which(is.na(data$x4))
[1] 3 5
OUTPUT: