Question 1
a. Determine the (i) mode and (ii) class of the diamonds data object.
b. How would you find how many rows and columns the object has by using R functions nrow and ncol ? Give the code and the result.
c. What is the value contained in row 12345 and the depth column (which contains the depth percentage)?
d. Write a line of code that creates a new data object called diamonds_imp which is of the same mode and class as the original diamonds data object and contains the same columns as the original, but also contains three new columns: x_imp , y_imp , z_imp where each of these measurements are Imperial measurements in inches, i.e. x_imp is equal to x divided by 25.4, as there are 25.4 mm in 1 inch. Show the first 6 rows of the resulting data object.
e. Write a line of code that adds a column named over_under to the diamonds_imp data object that contains the difference between the price of the diamond in that row and the median of the prices of other diamonds with the same color .
f. Write a line of code that creates a new data object from the original diamonds data object named
Expensive that contains only the diamonds whose price is strictly greater than $18800 and show the contents of that data object.
The Statistical Society of Canada (the SSC) is the professional society for statisticians in academics and industry in Canada. The Board of Directors for the Society is made up of an elected executive committee and elected regional representatives. Below is a partial list of the members of the Board of Directors of the SSC, along with their roles and the dates of the ends of their elected terms.
a. What objects (or values) are returned by the following lines of R code?
b. Using R code, write statements which yield the following three results:
Reviews
There are no reviews yet.