- Details
- Parent Category: Programming Assignments' Solutions

# We Helped With This Statistics with R Programming Homework: Have A Similar One?

Category | Programming |
---|---|

Subject | R | R Studio |

Difficulty | Undergraduate |

Status | Solved |

More Info | Statistics Project Helper |

## Short Assignment Requirements

## Assignment Description

**R Homework
Assignment One–Due Wednesday, January 17**^{th}

For this first homework assignment, you will **not **be
sending your work in the form of an R Script file. Rather, you should copy and
paste your work directly from the RStudio left-side console into a Word, or
Word-type, document. Your responses must include *both *your R command and
the resulting R output to get credit. If your answer includes only one or the
other, you will receive a 0 for that response. Make sure that you number the
questions clearly in your Word document so that we know which question you are
answering. [Please DO NOT copy the actual question into your Word document!! If
you do you will be deducted 10 points.] For the pie graph, please copy the
graph to the clipboard and paste insert it into your Word document in the
appropriate spot. (See the end of this assignment for a series of screen-captures
showing you how to pull this off in RStudio.)

When you have completed the assignment, save your Word document with the following name: SURNAME POL201 HA1 and upload it to Canvas in the appropriate place.

This assignment is worth **40 points total**.

NOTE: Most of this stuff you’ve already learned, while there are some parts of this assignment that can only be done successfully by referring to outside sources on R.

**Good luck!!**

1. **Problem 1**: [1 point each] Use R as a calculator to compute the
following values.

(c) ln(14^{2}), where *ln *is the natural logarithm.

(d) *e*(1), which should give Euler’s number.

(e) Calculate the absolute value of 13 − 22*/*1*.*2

2. **Problem 2**: [2 points each] Create the following vectors in R.

(a) v1, which has the elements (5,7,3)

(b) v2, which has the elements (0,5,10,15,...,100)

(c) v3, which has the elements (Yugoslavia,Yugoslavia,Canada,Canada,Czech Republic, Czech Republic,Croatia,Croatia,Hungary,Hungary,USA,USA)

(d) v3.1, which which is the same as v3 above but uses the repeat command.

(e) v4, which has the elements (2018,2012,2010,...,1918)

(f) v5, a vector whose values start at 20, end at 0, and contains 36 evenly spaced elements

3. **Problem 3**: [2 points each] For each of the following questions,
use R to find the answer. You must paste your R code in
order to get full marks!! That is, the answer alone is not enough.

(a) What are the 7th, 8th, and 12th elements of v5?

(b) Which elements of v5 are less than or equal to 13.5?

(c) What is the value of each of the elements of v5 that is less than or equal to 13.5?

(d) What is the percentage of elements of v5 that is less than 3.4?

(e) Which elements of v5 are
greater than 10 *and *less than 13?

(f) What are the values of the elements of v5 that are greater than 10 and less than 13?

4. **Problem 4**: [3 points] This will require you to do some Googlin’.
Draw a pie chart with two slices–the values of v5 that are greater than, and
those that are less than 15? [In other words, your pie chart should show the
relative percentage of values in v5 that are greater than 15 versus those that
are less than 15.] Use “export” and “copy to clipboard” from RStudio and paste
the pie chart into your MS Word document. Bonus point: make one of the pie
slices the color salmon and
the other slice the colour gold.

5. **Problem 5**: [2 points each] Find the following for the vector v1
(which you created above):

(a) mean

(b) median

(c) range

(d) standard deviation

The assignment is due via Canvas by 6:00 PM on Wednesday, January 17*th*.

Good luck!