Question: 5. R problem: We will use the painters data frame in the MASS package for the following exercises. To use the painters data frame, you


5. R problem: We will use the painters data frame in the MASS package for the following exercises. To use the painters data frame, you need to use the library function to call the MASS package. The first 6 observations of the painters data frame are listed below. > library (MASS) > head (painters) Composition Drawing Colour Expression School Da Udine 10 8 16 3 Da Vinci 15 16 4 14 Del Piombo 8 13 16 7 Del Sarto 12 16 9 8 Fr. Penni 0 15 8 0 Guilio Romano 15 16 14 Write a function called mean.sd to calculate the mean and standard deviation of a numeric variable. The first argument, dat, is the name of the data frame. . The second argument, varname, is the name of the numeric variable. Note that the mean.sd function returns a numeric vector of length of 2. The first component of the returned vector is the calculated mean; the second component is the calculated standard deviation. For example, here're the results if you call the mean.so function. > mean . sd (painters, "Composition") [1] 11. 555556 4.087102 >mean . sd (painters, "Drawing") [1] 12 . 462963 3. 457084
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
