[Solved] STAT823 Homework 2-R Objects

$25

File Name: STAT823_Homework_2_R_Objects.zip
File Size: 263.76 KB

SKU: [Solved] STAT823 Homework 2-R Objects Category: Tag:
5/5 - (1 vote)

Launch RStudio and open a new RMarkdown file or use the class RMarkdown template provided and save it on your working directory as a .Rmd file. At the end of the activity, save your pdf generated from RMarkdown+Knitr and submit it in the Blackboard dropbox.

Show all your work. Late submission will attract a penalty of 10 points per day after the due date.

If you have questions, please post them on the lesson discussion board.

  1. (a) Create a vector of length 10 and fill it with a sequence of integers.

(b) Coerce the vector into a matrix of 5 rows and 2 columns. (c) Name the columns of the matrix A and B.

  1. Assume that we have recorded the names and ages for four people: James is 27, Art is 42, Kate is 29, and Alex is 33.
    • Create a vector of names and a vector of ages from the data, making sure that you keep the ordering of the elements consistent.
    • Use the class() function to print the class metadata R has stored for each vector.
  • Using data.frame(), combine the two vectors into a dataframe and name the columns something informative. Print out the dataframe.
  1. A hypothetical data with heights (in cm) and weights (in kg) of 10 family members are shown below:

height (cm) weight (kg)

Niece 120 22
Son 172 52
GrandPa 163 71
Daughter 158 51
Yai 153 51
GrandMa 148 60
Aunty 160 50
Uncle 170 67
Mom 155 53
Dad 167 64
  • Create a vector called ht corresponding to the heights of the 11 family members. Assign the names of the family10 members to the names attribute of this vector.
  • Create a vector called wt corresponding to the family members weights.
  • Compute the body mass index (BMI: units should be kg/m2) of each person where BMI = weight/height2.
  • Identify the persons who have the lowest and highest BMI and calculate the standard deviation of the BMI.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] STAT823 Homework 2-R Objects[Solved] STAT823 Homework 2-R Objects
$25