Create new variable order based on "year"

Dear everybody,
I would like to ask for help. I would like to create a new variable named "order", which based on the order of the year. (For example , 2001 -> 1; 2002 ->2, 2003->3 )
I would like to ask for help. Thank you in advance.

        year = c(2001L,2002L,2003L,2004L,2001L,2002L,
      ticker = as.factor(c("AAA","AAA","AAA",

Take a look at ?rank

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.