# 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

discussed in class. Paste your graph into your solutions. Hint: help(iris)

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

## We've got everything to become your favourite writing service

### Money back guarantee

Your money is safe. Even if we fail to satisfy your expectations, you can always request a refund and get your money back.

### Confidentiality

We don’t share your private information with anyone. What happens on our website stays on our website.

### Our service is legit

We provide you with a sample paper on the topic you need, and this kind of academic assistance is perfectly legitimate.

### Get a plagiarism-free paper

We check every paper with our plagiarism-detection software, so you get a unique paper written for your particular purposes.

### We can help with urgent tasks

Need a paper tomorrow? We can write it even while you’re sleeping. Place an order now and get your paper in 8 hours.

### Pay a fair price

Our prices depend on urgency. If you want a cheap essay, place your order in advance. Our prices start from $11 per page.