Exercises


The following packages are required for this practical:

and if you’d like the same results as I have obtained, you can fix the random seed


  1. Use a pipe to do the following:

  1. Use a pipe to assign values 1:5 to object x and verify that the object exists.
  1. Use a pipe to calculate the correlation matrix on the anscombe data set

  1. Now use a pipe to calculate the correlation for the pair (x4, y4) on the anscombe data set

  1. Use a pipe to calculate the correlation between hgt and wgt in the boys data set from package mice.

  1. In the boys data set, hgt is recorded in centimeters. Use a pipe to transform hgt in the boys dataset to height in meters and verify the transformation

  1. Use a pipe to plot the pair (hgt, wgt) two times: once for hgt in meters and once for hgt in centimeters. Make the points in the ‘centimeter’ plot red and in the ‘meter’ plot blue.

End of Practical


Useful References