R Code

Please submit a document (word or PDF) containing a summary of your results and the R code used to generate your results. In your R code, insert comments when appropriate to increase readability. At bare minimum, you should insert question numbers before the code block that you use to answer the question.
Q1. Use the below R command to randomly sample 15 data points from beaver1$temp and assign them to a vector, temp. (60 points – 6 points for each sub-question)
temp <- sample(beaver1$temp, 15)
A. Display the vector, temp. Since values in temp is randomly sampled, it is necessary that you report the data values in temp so that we can evaluate your answers for the downstream questions.
B. Compute the mean and median of temp. Convert the data in temp into integers and save them into a vector, temp_int. Compute the mode of temp_int.
C. Compute the variance and the standard deviation of temp.
D. Compute the five number summary, the interquartile range, and outliers, if any in temp.
E. Compute the standardized version (z-scores) of temp.
F. Identify values that are less than the first quartile of the data.
G. Using indexing, show the expression for accessing the first item and the last one of temp. The code should work for a vector of any size (in another word, no hard coding).
H. Create a matrix of size 3 x 5 using the data in temp. The first five values belong to the first row of the matrix. Assign the result to the variable, temp.matrix, and display the result.
I. Show the code for displaying the first and the last columns of the matrix. The code should work for matrices of any size (in another word, no hard coding).
J. Assign row names for the temp.matrix as Row1, Row2, and Row3. Assign column names as Day1, Day2, …. The code should work for matrices of any size. For any coding assignment visit our homework help website.

Q2. Using function data() to load R data set air quality. (40 points – 8 points for each sub-question)
A. How many variables are there? How many observations are there?
B. Are there missing values in the data set? If so, clean up the data by removing those observations with missing values and save the cleaned data set. Report the number of observations in the cleaned data set.
C. Show the mean, median, mode, 1st and 3rd quantiles of variables Temp and Wind in the cleaned data set.
D. In the cleaned data set, how many days the Temp is greater than 80 and how many days the Wind is less than 6?
E. The numbers in column Temp represent temperature in Fahrenheit. Modify the cleaned data set by adding a new column, Temp C, showing temperature in Celsius. Display the new resulting data frame. The equation to convert Fahrenheit to Celsius: T(°C) = (T(°F) – 32) × 5/9.

Don't use plagiarized sources. Get Your Custom Essay on
R Code
From as low as $9/Page
Order Essay
The Homework Writings
Order NOW For A 10% Discount!
Pages (550 words)
Approximate price: -

Our Advantages

Plagiarism Free Papers

Thehomeworkwritings.com’s team of writers write all papers from scratch. We deliver 100% original, unique papers. That’s what makes us the best custom homework writing service

Free Revisions

We provide unlimited free revisions to all customers and on all papers. Try The Homework Writings today for the best custom homework writing service and experience in the industry.


Thehomeworkwritings.com gives clients title pages free of charge. Your only job is to fill out our order form. We will handle the rest.


As the leading essay writing service, we never submit any paper without a reference/bibliography page. We do this free of charge too.

Originality & Security

At Thehomeworkwritings.com, we take great pride in delivering only high-quality 100% original papers to all our clients. We also never share any of our clients’ information with third parties. Your data is safe with us.

24/7 Customer Support

No other custom homework writing service has a friendly, always available customer support team to respond to clients like us.

Try it now!

Calculate the price of your order

We'll send you the first draft for approval by at
Total price:

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Why outsource our services

We have the best customer support team for your essay writing needs.


Flexible Pricing

You won’t find any other custom homework writing service with pricing as flexible and affordable as ours.


Admission help & Client-Writer Contact

We provide a direct line of communication with our writers for the best writing experience.


Paper Submission

As the leading custom homework writing service, we take deadlines very seriously. You will have your paper submitted on time without any delays.


Customer Feedback

We truly value your feedback, good or bad, and always use your feedback to help us provide you with an even better custom homework writing service