mean_heart_weight <- calculate_mean(cats$HeartWeight)
mean_body_weight <- calculate_mean(cats$BodyWeight)
max_heart_weight <- calculate_max(cats$HeartWeight)
max_body_weight <- calculate_max(cats$BodyWeight)
cat( sprintf("Heart Weight: mean = %.2f, max = %.2f\n",
mean_heart_weight, max_heart_weight) )
cat( sprintf("Body weight: mean = %.2f, max = %.2f\n",
mean_body_weight, max_body_weight) )
should print;
Heart Weight: mean = 10.63, max = 20.50
Body weight: mean = 2.72, max = 3.90
(note, if you have restarted your R session you will need to re-type the calculate_mean
and calculate_max
functions. You can find them in the “History” pane by clicking on the “History” tab on the top right)