Data Science
PRACTICAL FILE
SUBMITTED BY – HItarth Khurana
CLASS & SEC. – 11th-‘D’
ROLL NO. - 40
INDEX
Sr. No. Contents Remarks
1. Practical
Questions
2. Mini Project
3. Mini Project
Conclusion
4. Practical
Questions
Conclusion
PRACTICAL QUESTIONS
[Link] variables of different data types in R and display their class.
2. Create a vector of 10 random integers and find its mean, minimum and
maximum.
3. Perform arithmetic operations on two numeric vectors.
4. Create a 3x3 matrix and perform matrix addition and multiplication.
5. Create a list containing a vector, a string and a logical value.
6. Create a data frame with student details (Name, Age, Marks) and display
its summary.
7. Find missing values in a dataset.
8. Filter data based on a condition (Marks > 75).
9. Calculate mean, median, variance and standard deviation of a numeric
column.
10. Draw a bar plot, histogram and boxplot using R.
11. Create a scatter plot between two numeric variables.
12. Write a user-defined function to calculate sum and mean of a vector.
Mini Project
13. Perform EDA on a real-life dataset and write observations.
Summary – Exploratory Data
Analysis (EDA):-
Dataset Description:
For this project, the dataset chosen is mtcars.
It contains information about 32 car models with variables such as:
- mpg – Miles per gallon (fuel efficiency)
- hp – Horsepower (engine power)
- wt – Weight of the car
- cyl – Number of cylinders
- Other attributes like displacement, transmission type, etc.
Key Interpretations:
1. Fuel Efficiency vs Horsepower :
- Cars with higher horsepower generally have lower mpg.
- Indicates a trade‑off between power and fuel economy.
2. Weight Impact :
- Heavier cars (higher wt) tend to consume more fuel (lower mpg).
- Weight is strongly correlated with efficiency.
3. Cylinder Count :
- Cars with more cylinders (6 or 8) usually have higher horsepower but
lower mpg.
- 4‑cylinder cars are more fuel‑efficient.
4. Overall Variation :
- Wide range in horsepower (50–335) and mpg (10–34).
- Shows diversity in car designs and performance.
Conclusions for Q1–Q12
Q1. Variables of Different Data Types
- Code does: Creates variables of numeric, character, and logical types, then
checks their class.
- Output means: R correctly identifies each variable’s data type (“numeric”,
“character”, “logical”).
Q2. Vector of Random Integers
- Code does: Generates 10 random integers and calculates mean, min, max.
- Output means: Shows the average value, smallest number, and largest
number in the vector.
Q3. Arithmetic on Two Vectors
- Code does: Performs element‑wise addition, subtraction, multiplication, and
division.
- Output means: Demonstrates how R applies arithmetic operations across
corresponding elements of vectors.
Q4. Matrix Addition & Multiplication
- Code does: Creates two 3×3 matrices, adds them, and multiplies them.
- Output means: Addition gives element‑wise sums; multiplication gives
algebraic matrix product.
Q5. List Creation
- Code does: Creates a list containing a numeric vector, a string, and a logical
value.
- Output means: Lists can store heterogeneous data types together in one
object.
Q6. Data Frame Summary
- Code does: Builds a data frame with student details and runs summary().
- Output means: Displays min, max, mean for numeric columns and counts
for categorical columns.
Q7. Missing Values
- Code does: Creates a vector with NA values and checks them using [Link]().
- Output means: Returns TRUE where data is missing, FALSE where data is
present.
Q8. Filtering Data
- Code does: Uses subset() to select rows where Marks > 75.
- Output means: Shows only students who scored above 75, filtering the
dataset.
Q9. Statistical Measures
- Code does: Calculates mean, median, variance, and standard deviation of
marks.
- Output means: Provides central tendency (mean, median) and spread
(variance, SD) of the data.
Q10. Bar Plot, Histogram, Boxplot
- Code does: Draws three different plots for marks data.
- Output means:
- Bar plot compares marks of individual students.
- Histogram shows frequency distribution of marks.
- Boxplot shows median, min, max, and spread of marks.
Q11. Scatter Plot
- Code does: Plots Age vs Marks using plot().
- Output means: Shows relationship between age and marks visually, each
point representing one student.
Q12. User‑Defined Function (Sum & Mean)
- Code does: Defines a function that calculates sum and mean of a vector.
- Output means: Returns both values together, demonstrating reusability of
custom functions.
THANK YOU