Wow, that was simple... never thought about padding right or left. Thanks a lot! I just figured out how to treat other neighborhood sizes: With[{r = Range@5, n = 4}, Partition[PadRight[r, Length@r + n - 1, r], n, 1]] Any idea about introductory texts? I had all of Trott's books out could never follow two consecutive pages. Guess I need the groups for dummies book.
Using Join and Take
Join
Take
With[{r = Range@5, n = 4}, Partition[Join[r, Take[r, n - 1]], n, 1]] (* {{1, 2, 3, 4}, {2, 3, 4, 5}, {3, 4, 5, 1}, {4, 5, 1, 2}, {5, 1, 2, 3}} *)
This is one way:
r = Range@5 Partition[PadRight[r, Length@r + 1, First@r], 2, 1] (* {{1,2},{2,3},{3,4},{4,5},{5,1}} *)