search for: df_sort

Displaying 4 results from an estimated 4 matches for "df_sort".

Did you mean: do_sort
2012 Jul 18
2
How to have original (name) order after melt and cast command
...6320 23 2012-03-26  lmn 10.203993350 24 2012-03-23  lmn 10.229667040 25 2012-03-22  lmn 10.209677420 26 2012-03-21  lmn 10.229277930 27 2012-03-20  lmn 10.024391920 attach(dat1) library(plyr) library(reshape) in.melt <- melt(dat1, measure = 'rate') (df = cast(in.melt, date ~ name)) df_sorted = df[order(as.Date(df$date, "%m/%d/%Y"), decreasing = TRUE),] > df_sorted         date         abc         lmn         xyz 9 2012-03-30    5.550737 10.11885 0.065550707 8 2012-03-29    4.877621 10.18570 0.001825007 7 2012-03-28    5.462477 10.04977 0.054441969 6 2012-03-27    4.972...
2010 Aug 27
1
Band-wise Sum
...430325.24, 1180946.57, 150000, 167490, 81255.16, 54812.5, 3000, 1275702.94, 9100, 1763142.3, 3283048.61, 1200000, 11800, 3000,  96894.02,  453671.72,  7590, 106065.24, 940711.67,  2443000, 9500000, 39000, 1501939.67) ## First I have sorted the data rating-wise as df <- data.frame(rating, ead) df_sorted <- df[order(df$rating),] df_sorted_AAA <- subset(df_sorted, rating=="AAA")      df_sorted_AA <- subset(df_sorted, rating=="AA") df_sorted_A <- subset(df_sorted, rating=="A") df_sorted_BBB <- subset(df_sorted, rating=="BBB") df_sorted_BB &l...
2010 Aug 30
2
Band-wise Conditional Sum - Actual problem
...255.16, 54812.5, 3000, 1275702.94, 9100, 1763142.3, 3283048.61, 1200000, 11800, 3000,  96894.02,  453671.72,  7590, 106065.24, 940711.67,  2443000, 9500000, 39000, 1501939.67) df$ead.cat <- cut(df$ead, breaks=c(0, 100000, 500000, 1000000, 2000000, 5000000 , 10000000, 100000000) ) df          df_sorted <- df[order(df$rating),]      # the output is as given below. > df_sorted    rating         ead                     ead.cat 1       A          169229.93        (1e+05,5e+05] 3       A         5877794.25        (5e+06,1e+07] 6       A            21000.00               (0,1e+05] 12      A ...
2013 Apr 15
6
Sorting data.frame and again sorting within data.frame
...   values A            4/15/2013      31 A            4/14/2013     102 A            4/13/2013      31 B            4/15/2013      34 B            4/14/2013      47 B            4/13/2013      17 C            4/15/2013      10 C            4/14/2013      29 C            4/13/2013      11 I tried df_sorted = df[order(df$names, (as.Date(df$dates, "%m/%d/%Y")), decreasing = TRUE),] > df_sorted   names     dates values 1     C 4/15/2013     10 9     C 4/14/2013     29 5     C 4/13/2013     11 6     B 4/15/2013     34 8     B 4/14/2013     47 4     B 4/13/2013     17 3     A 4/15/2013   ...