# stat 540 hw

1. Use R to answer the following questions. Before beginning, load the necessary data sets by
entering the following commands:
> data(iris)
> data(islands)
> data(mtcars)
Directions for problem 1: When I ask you below “what type of object is ______”, answer with
one of the following:
vector, factor, matrix, data frame, list, or function
Be as specific as possible; for example, all matrices are arrays, but not all arrays are matrices.
So, if ______ is in fact a matrix, calling it an array is not a full credit answer. Also, a data frame
is a special case of a list, so if ________ is a data frame, calling it a list is not a full credit answer.
Note: If ________ is a vector or matrix, give me the data storage mode also, as specifically as
possible (“numeric” is not specific enough). Finally, tell me in each case how you reached your
answer i.e. if you used R commands, looked at the object onscreen, etc.
Two points each.
a. What type of object is iris ?
b. What type of object is the column named Species in the data set iris?
c. What type of object is islands ?
d. What place is measured in the 19th component of islands?
e. What type of object is the row names of the mtcars data?
Stat 540 Hwk 1 p.1
2. For each part below, give a single R command to accomplish the goal. Two points each.
a. Create a regularly spaced sequence of values between 0 and 10, by increments of 0.2. Do
not use the c() function.
b. Create a regularly spaced sequence from - to , of length 10. Do not type in the numerical
value of  – use a built-in trig function or built-in value to create it – this will give doubleprecision accuracy. Do not use the c() function.
c. In the islands object, New Zealand appears twice – the Northern island and the Southern
island. Give a single command to calculate the total area of both islands taken together.
d. Obtain the 5-number summary for mpg in the mtcars data frame with one command.
e. Find the standard deviation of Sepal Lengths for the iris species setosa with one command.
3. (7) Make a well-labeled histogram of the Sepal lengths of the iris setosa species. Use your
favorite color for the bars. By well-labeled, I mean follow the guidelines of the handout
4. (8) For the iris data, construct side-by-side boxplots of the Sepal lengths for the three species.
Label the plot appropriately for a formal report. Hint: read the help file for boxplot.
Stat 540 Hwk 1 p.2

Don't use plagiarized sources. Get Your Custom Essay on
stat 540 hw
Just from \$13/Page
Calculator

Total price:\$26
Our features

## Need a better grade? We've got you covered.

Order your essay today and save 20% with the discount code GOLDEN