R Programming Worksheet

Show all of your work / code, unless stated. No credit will be given if there is no work /code.
Load the ISWR package using the code library (ISWR). Note: Tthe ISwR package must first be
installed on your computer before you can load it.
1. You will be using the dataset “juul2” for the following questions.
Dataset background: It contains a reference sample of the distribution of insulin-like growth
factor (IGF-I), one observation per subject in various ages, with the bulk of the data collected
in connection with school physical examinations.
(a) The function Is() displays elements in your workspace. It also displays elements in a data
frame.
i. How would you use this function to find the elements of the dataset juul? Write your
code.
ii. Use the code you wrote in part (i) to list the 8 column names in the dataset juul2.
iii. Write the code that you need to reference the age column in the dataset.
(b) What is the how many rows are in the age column? Write your code and the solutions. Note:
This is actually the sample size for the dataset because each row in the table represents a
different person. Hint: Use the length function.(c) For the age column, how many entries are listed as “NA”? Write your code and the solutions.
(d) Find the mean and standard deviation of age. Write your code and the solutions. Be sure
to remove any entries that are NA while performing calculations. Hint: Use the mean and sd
functions.
(e) How many subjects are boys (sex = 1)? How many subjects are girls (sex = 2)? Write your
code and the solutions. Be sure to remove the NA values before doing calculations. Hint: One
way is to create a new dataset with the NAs removed, then find your value. Another method
is to use the & comparison operator.
(f) We are interested in the average BMI. You will need to use the weight and height columns
in this dataset. Weight is given in kilograms, but height is given in centimeters. Write code
converting height to meters, then find the BMI for each person individually, and then find the
overall (average) BMI. Report your code and the average BMI value you find.(g) Find the maximum and minimum values of height. Write your code and the solutions. Be
sure to remove the NA values before doing calculations. Hint: Use the max and min functions.
(h) Give code describing how you would create a single scatterplot between weight and height
with the following options:
• Plot the points where the points are X’s. Hint: Here is a list of the possible symbols:
http://www.endmemo.com/program/R/pchsymbols.php
Put weight on the z-axis, and height on the y-axis.
Make the label on the z-axis as “Weight (kg)”
Make the label on the y-axis as “Height (cm)”
Make the z-axis limits to be 10-100
• Make the y-axis limits to be 90-205
• Add the main title “Plot of Height vs Weight”
You do not need to provide the plot.2. Matrix Work.
(a) Create a 4 x 5 matrix from the sequence of numbers going from 10 to 105 (inclusive) by
5’s. Have the values going into the matrix by rows. Report your code only.
(b) Bind the matrix you just created with the vector [1, 2, 3, 9, 10] to create a 5 x 5 matrix.
Report your code only.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER