Question: Lab: Manipulating Data frames The dataframe is one of the most essential data structures used in R. It is conceptually equivalent to a database relation

 Lab: Manipulating Data frames The "dataframe\" is one of the most

Lab: Manipulating Data frames The "dataframe\" is one of the most essential data structures used in R. It is conceptually equivalent to a database \"relation" and to the typical rectangular dataset with variables as columns and cases as rows. For this activity, you will gain some skill with manipulating a dataframe. Task 1: R offers several built-in dataframes: For this activity we will use the "mtcars" dataset that contains 1 1 variables and 32 cases representing different models of cars. The goal is to create a new variable for this dataframe that represents the engine displacement per cylinder in cubic inches for each vehicle. You may not know what displacement is [or maybe even cylinders]; but it will suffice to know that values in the column named "disp" divided by values in the column named "cyl" will yield the appropriate quantity. One fundamental principle of working with data is that you should never overwrite or change your original raw data. Therefore, your very rst line of code should be: my_mtcars ( mtcars # Copy original dataframe into a new one From that point forward you can work on my_mtcars without mucking up the original data. Also note that in order to establish that you have completed the assignment correctlyJ your last command should summarize your new variable using the summary function. The output of that nal command should look exactly like this: Min. let Qu. Median Mean 3rd Qu. Max. 17.?T 26.92 34.48 35.03 43.19 59.00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!