Thursday, 19 September 2013

How to generate data frame following a pattern

How to generate data frame following a pattern

I'm trying to find a quick (i.e. not manual) way of generating a data
frame that follows the following pattern. The columns are accident yearand
development_year:
accident_year development_year
2 10
3 9
3 10
4 8
4 9
4 10
5 7
5 8
... ...
5 10
... ...
10 2
... ...
10 10
So for the accident_year column I need a vector that goes has one 2, two
3s, three 4s and so on. For the other column (development year) I
basically need a vector of sequences 10,9, 10,9,8, 10,9,7, ... ,
10,9,8,7,6,5,4,3,2.
Does anyone know how to easily generate those?
Thanks!

No comments:

Post a Comment