14.2 Exercise: Simple statistics and contingency tables

  1. Find at least two ways to calculate the product of all numbers 1 to 8 with the help of R (Tipp cumprod()).
  2. Store the values for the two variables Assault and UrbanPop (dataframe USArrests) in two vectors x and y. Calculate for both vectors x and y the mean, the maximum, the minimum and the variance and save all the results in two objects statistics.x and statistics.y. Name the elements of these two objects “Mean”, “Max” etc. Save statistics.x and statistics.y as list elements in one list. Finally, check wether the two vectors x and y strongly correlate with each other.