Create a list squares
that contains all the square numbers in the range 0 to 9 in its first component, all the square numbers in the range 10 to 19 in the second component, and so on up until its last component containing all the square numbers in the range 90 to 99. For example, the squares of the numbers 0 up to 9 are:
c(0, 1, 4, 9, 16, 25, 36, 49, 64, 81)
That means that the numbers 0
, 1
, 4
and 9
go into the first component of the list squares
, the number 16
goes into the second component of squares
and so on. You can name these components 0 to 9
, 10 to 19
etc. but that is optional. What is required, however, is that all ranges are specified in squares
, so components without any square numbers should have the value NULL
.
(from: Cotton, 2013, Learning R, O’Reilly)