This exercise consists of two parts:
sum_of_squares()
that calculates the sum of the first n
square numbers. Hint: The formula is n * (n + 1) * (2 * n + 1) / 6
.squares_data
with two columns: the first column x
should contain the numbers 1 to 10, the second column y
should contain the sum of the squared numbers up to the corresponding value in x
, i.e. the result of sum_of_squares(1:10)
.
(from: Cotton, 2013, Learning R, O’Reilly)