Skip to content
Prev 306317 / 398506 Next

Change in order of names after applying "plyr" package

Here is one of the places that you need a 'factor' to create the
ordering you want; notice the statement that I added:
+         , "Air", "Air", "Air", "Air", "Air", "Air", "Air", "Air", "AB"
+         , "AB", "AB", "AB", "AB", "AB", "AB", "AB", "AB", "AB", "AB"
+         , "AB", "AD",  "AD", "AD", "AD", "AD", "AD", "AD", "AD", "AD"
+         , "AD", "AD", "AD")
+     , ason_date = c("10-Jan-12","9-Jan-12","8-Jan-12", "7-Jan-12"
+         , "6-Jan-12","5-Jan-12","4-Jan-12","3-Jan-12","2-Jan-12"
+         ,"1-Jan-12", "31-Dec-11", "30-Dec-11", "10-Jan-12","9-Jan-12"
+         ,"8-Jan-12", "7-Jan-12", "6-Jan-12","5-Jan-12","4-Jan-12"
+         ,"3-Jan-12","2-Jan-12","1-Jan-12", "31-Dec-11", "30-Dec-11"
+         , "10-Jan-12","9-Jan-12","8-Jan-12", "7-Jan-12", "6-Jan-12"
+         ,"5-Jan-12","4-Jan-12","3-Jan-12","2-Jan-12","1-Jan-12"
+         , "31-Dec-11", "30-Dec-11")
+     , security_rate = c(0.597,0.61,0.6,0.63,0.67,0.7,0.74,0.735
+         , 7.61,0.795,0.796, 0.84, 8.5,8.1,8.9,8.9,8.9,9,9,9,9,9,9,9
+         ,3.21,3.22,3.12, 3.51, 3.5, 3.37, 3.25, 3, 3.07, 3, 2.94, 2.6)
+     )
+                             , levels = c("Air", "AB", "AD")
+                             )


Here are the results:
$Air
[1] 6.229422

$AB
[1] 0.2355425

$AD
[1] 0.2918782

attr(,"split_type")
[1] "data.frame"
attr(,"split_labels")
  security_id
1         Air
2          AB
3          AD
On Wed, Sep 26, 2012 at 4:55 AM, Vincy Pyne <vincy_pyne at yahoo.ca> wrote: