Question: Use R Programming language to solve the following questions: Use R Programming language: 2. Data Frame Management: (a) Download and import the diamond data set

Use "R Programming language" to solve the following questions:

Use R Programming language:

2. Data Frame Management: (a) Download and import the diamond data set from Blackboard. (b) Remove the depth column and rename the columns x, y and z as length, width and depth. (c) The missing values are encoded differently in the data set, i.e. missing, MISSING and NA. Find the occurrence of each of them. (d) Assign NA to all missing values found above. (e) Find proportion of missing values per column. (f) Remove all missing values from the data set and create a new data set data.complete. (g) Check the structure of the data set and convert them to the appropriate data types. (h) For the numeric columns, replace the missing values with the column mean. (i) Make the cut, color and clarity columns into factors. (j) Reorder the data frame by carat variable in the descending order and output the first 6 rows. (Hint: ?order) (k) Take a subset of the data frame so that diamonds with at least 0.2 carat, I color or above (D is the highest colorless diamond grade), VVS1 or VVS2 clarity, price between $330 to $400 are kept. How many dimonads in the data set satisfies this condition?

Diamond data set:

carat cut color clarity depth table price x y z 0.23 Ideal E SI2 61.5 55 326 3.95 3.98 2.43 0.21 Premium E SI1 59.8 61 326 3.89 3.84 2.31 0.23 Good E VS1 56.9 65 327 4.05 4.07 2.31 0.29 Premium I VS2 62.4 58 334 4.2 2.63 0.31 Good J SI2 63.3 335 4.34 4.35 2.75 0.24 Very Good J VVS2 62.8 57 336 3.94 3.96 2.48 0.24 Very Good I VVS1 62.3 57 336 3.95 2.47 0.26 Very Good H SI1 missing 55 337 4.07 4.11 2.53 0.22 Fair E VS2 65.1 61 3.87 3.78 2.49 0.23 Very Good H VS1 59.4 61 338 4 4.05 MISSING 0.3 Good J SI1 64 55 339 4.25 4.28 2.73 0.23 Ideal J VS1 62.8 340 3.93 3.9 2.46 0.22 Premium F SI1 60.4 61 342 3.88 3.84 0.31 Ideal J 62.2 54 344 4.35 4.37 2.71 0.2 Premium E SI2 60.2 62 345 3.79 3.75 2.27 0.32 Premium E I1 60.9 58 345 MISSING 4.42 2.68 0.3 Ideal I SI2 62 54 348 4.31 4.34 2.68 0.3 Good J SI1 63.4 54 351 4.23 4.29 2.7 0.3 Good J SI1 63.8 351 4.23 4.26 2.71 0.3 Very Good J SI1 62.7 59 351 4.21 4.27 NA 0.3 Good I SI2 63.3 56 351 4.26 4.3 2.71 0.23 Very Good E 63.8 352 3.92 2.48 0.23 Very Good H VS1 61 57 3.94 3.96 2.41 0.31 Very Good J SI1 59.4 62 353 4.39 4.43 MISSING 0.31 Very Good J SI1 62 353 4.44 4.47 2.59 0.23 Very Good G VVS2 60.4 58 354 4.01 2.41 0.24 Premium I missing 62.5 57 355 3.97 3.94 2.47 0.3 J VS2 62.2 57 357 4.28 4.3 2.67 0.23 Very Good D VS2 60.5 61 357 3.96 3.97 2.4 0.23 Very Good F NA 60.9 57 357 3.96 2.42 0.23 Very Good F VS1 MISSING 57 4 4.03 2.41 0.23 Very Good F VS1 59.8 57 4.04 4.06 2.42 0.23 Very Good E VS1 60.7 59 402 missing 4.01 2.42 0.23 missing E VS1 59.5 58 402 4.01 4.06 2.4 0.23 Very Good D VS1 58 402 3.92 3.96 2.44 0.23 Good VS1 58.2 402 4.06 4.08 2.37 0.23 Good E VS1 64.1 59 402 3.85 2.46 0.31 Good H SI1 64 54 402 4.29 4.31 2.75 0.26 Very Good D VS2 60.8 59 403 4.13 4.16 2.52 0.33 Ideal J SI1 61.1 56 403 4.49 4.55 2.76

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 Databases Questions!