DS On MTCARS
DS On MTCARS
Create two vectors from the mtcars dataset: one for mpg and another for hp. Compute
their sum, difference, product, and division.
Extract all car models from mtcars where mpg is greater than 25.
4. Appending to a Vector
Question:
Start with an empty vector and append car names with mpg greater than 30.
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 the cyl column into a factor and analyze category counts.