Try this:

data2[order(data2[,2], match(data2[,1], tolower(month.abb))),]

On Fri, Sep 11, 2009 at 10:46 AM, megh <megh700004@yahoo.com> wrote:

>
> I have following object :
>
> > date2
>       [,1]  [,2]
>  [1,] "apr" "1992"
>  [2,] "aug" "1992"
>  [3,] "dec" "1992"
>  [4,] "feb" "1992"
>  [5,] "jan" "1992"
>  [6,] "jul" "1992"
>  [7,] "jun" "1992"
>  [8,] "mar" "1992"
>  [9,] "may" "1992"
>  [10,] "nov" "1992"
>  [11,] "oct" "1992"
>  [12,] "sep" "1992"
>  [13,] "apr" "1993"
>  [14,] "aug" "1993"
>  [15,] "dec" "1993"
>  [16,] "feb" "1993"
>  [17,] "jan" "1993"
>  [18,] "jul" "1993"
>  [19,] "jun" "1993"
>  [20,] "mar" "1993"
>  [21,] "may" "1993"
>  [22,] "nov" "1993"
>  [23,] "oct" "1993"
>  [24,] "sep" "1993"
>  [25,] "apr" "1994"
>  [26,] "aug" "1994"
>  [27,] "dec" "1994"
>  [28,] "feb" "1994"
>  [29,] "jan" "1994"
>  [30,] "jul" "1994"
>
> Now I want to sort the elements like below, and want to get the index
> numbers of "date2" under following sorting scheme.
>
> "jan" "1992"
> "feb" "1992"
> "mar" "1992"
> ............
> "dec" "1992"
> "jan" "1993"
> "feb" "1993"
> "mar" "1993"
> ............
> "dec" "1993"
> "jan" "1994"
> "feb" "1994"
> "mar" "1994"
> ............
> "dec" "1994"
>
> Can anyone help me please?
> --
> View this message in context:
> http://www.nabble.com/Sorting-tp25401249p25401249.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]


