Is there a way to create a list similar to the one below in R, using perhaps lapply()other more extrapolated procedures?
ones = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
twos = c(1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1)
threes = c(1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0)
fours = c(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0)
fives = c(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
l = list(ones, twos, threes, fours)
[[1]]
[1] 1 1 1 1 1 1 1 1 1 1 1
[[2]]
[1] 1 0 1 0 1 0 1 0 1 0 1
[[3]]
[1] 1 0 0 1 0 0 1 0 0 1 0
[[4]]
[1] 1 0 0 0 1 0 0 0 1 0 0
They correspond to the coefficients of polynomials in the generating functions for partitions.
The first list is for ones, and therefore the calculation is performed in increments 1of an integer; therefore, the vector 1,1,1,1,1,1,1,...In the record [[2]]we have twos, and we look forward to 2starting with 0, skipping 1(encoded as 0). In [[3]]we are counting on 3's: zero, three, six, nine, etc.