Answered step by step
Verified Expert Solution
Question
1 Approved Answer
R Data Frames Exercises For this exercise we will test your knowledge of data frames! Just follow the exercise instructions that are in bold below!
R Data Frames Exercises For this exercise we will test your knowledge of data frames! Just follow the exercise instructions that are in bold below! Ex 1: Recreate the following dataframe by creating vectors and using the data.frame function: In [3]: Out[3]: Ex 2: Check if mtcars is a dataframe using is.data.frame() In [1]: Out[1]: TRUE Ex 3: Use as.data.frame() to convert a matrix into a dataframe: In [3] : Out [3]: Ex 4: Set the built-in data frame mtcars as a variable df. We'll use this df variable for the rest of the exercises. In [4]: df 20.090625 Ex 7: Select the rows where all cars have 6 cylinders (cyl column) Ex 8: Select the columns am,gear, and carb. Ex 9: Create a new column called performance, which is calculated by hp/wt. In [13]: In [14]: head(df) Out [14]: Ex 10: Your performance column will have several decimal place precision. Figure out how to use round() (check help(round)) to reduce this accuracy to only 2 decimal places. In [16]: In [17]: head(df) Out [17]: Ex 10: What is the average mpg for cars that have more than 100hpAND a wt value of more than 2.5. In [20]: Out [20]: 16.8636363636364 Ex 11: What is the mpg of the Hornet Sportabout
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started