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

DS On MTCARS

The document outlines various tasks involving the mtcars dataset, including vector operations for mpg and hp, filtering data based on mpg, counting occurrences of cars with specific gear counts, and appending car names based on mpg criteria. It also covers working with lists to manage car details, matrices for mpg, hp, and gear columns, and data frames for various operations like filtering and modifying attributes. Additionally, it discusses converting columns to factors and merging the mtcars dataset with another dataset containing vehicle prices.

Uploaded by

siddharth.tcsc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

DS On MTCARS

The document outlines various tasks involving the mtcars dataset, including vector operations for mpg and hp, filtering data based on mpg, counting occurrences of cars with specific gear counts, and appending car names based on mpg criteria. It also covers working with lists to manage car details, matrices for mpg, hp, and gear columns, and data frames for various operations like filtering and modifying attributes. Additionally, it discusses converting columns to factors and merging the mtcars dataset with another dataset containing vehicle prices.

Uploaded by

siddharth.tcsc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Vector Operations on mtcars


Question:

 Create two vectors from the mtcars dataset: one for mpg and another for hp. Compute
their sum, difference, product, and division.

2. Filtering Data from a Vector


Question:

 Extract all car models from mtcars where mpg is greater than 25.

3. Counting Occurrences in a Vector


Question:

 Count how many cars have 4 gears in the mtcars dataset.

4. Appending to a Vector
Question:

 Start with an empty vector and append car names with mpg greater than 30.

5. Working with Lists


Question:

 Create an employee-like list for car details (model, mpg, hp, gear count). Perform:
o Retrieve all car models.
o Update horsepower values.
o Merge with another list containing car weights.
o Remove gear information.
6. Working with Matrices
Question:

 Convert mpg, hp, and gear columns into a matrix. Perform:


o Retrieve specific rows and columns.
o Add new rows and columns.
o Remove specific rows and columns.

7. Working with Data Frames


Question:

 Perform operations on mtcars as a data frame:


o Retrieve specific rows and columns.
o Add new attributes.
o Remove specific rows and columns.
o Filter cars with hp greater than 150.

8. Working with Factors


Question:

 Convert the cyl column into a factor and analyze category counts.

9. Merging Multiple Data Sources


Question:

 Merge mtcars with another dataset containing vehicle prices.

You might also like