ranksCount.Rd
Computes number and percent of times that each rank is taken by each statistical unit.
ranksCount(x, decim = 2, path, year = "")
A dataframe containing the ranks for different simulations - such as returned by linearAggExc(). Column 1 - statistical units (countries, regions, companies etc.). Column 2 - time (year, or month, or day etc. - numeric). Rest of columns - ranks in simulations.
Numeric. Specifies the number of decimals to display in case of percent. Default is 2.
Specifies the path to the folder where the returned .csv files of ranksNb and ranksPc are to be saved.
Specifies the period in case the user wants the retrned files to be saved as "RanksNb year.csv" and "RanksPc year.csv"
If path is missing, it returns a list of two data frames (ranksNb and ranksPc). If path is specified, it also writes two .csv files (RanksNb and RanksPc) in the path folder. Countries and time are written in column 1 and 2, respectively.
ranks2001[1:5,]
#> Statistical.unit Time S0 S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 S14 S15
#> 1 Belgium 2001 14 15 14 18 16 16 10 19 14 14 14 14 14 14 14 12
#> 2 Bulgaria 2001 8 7 8 6 10 6 13 8 9 6 8 8 7 7 8 6
#> 3 Czech Republic 2001 5 4 6 5 5 5 6 5 6 8 6 6 5 6 5 8
#> 4 Denmark 2001 25 25 25 25 25 23 24 25 25 25 25 25 25 24 24 26
#> 5 Germany 2001 13 11 12 12 8 12 7 13 12 11 12 13 12 13 11 19
#> S16 S17
#> 1 10 19
#> 2 20 15
#> 3 17 10
#> 4 27 3
#> 5 2 13
a=ranksCount(ranks2001)
a$rankNb[1:5,]
#> Statistical unit Time R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16
#> 1 Belgium 2001 0 0 0 0 0 0 0 0 0 2 0 1 0 9 1 2
#> 2 Bulgaria 2001 0 0 0 0 0 4 3 6 1 1 0 0 1 0 1 0
#> 3 Czech Republic 2001 0 0 0 1 7 6 0 2 0 1 0 0 0 0 0 0
#> 4 Denmark 2001 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 5 Germany 2001 0 1 0 0 0 0 1 1 0 0 3 6 5 0 0 0
#> R17 R18 R19 R20 R21 R22 R23 R24 R25 R26 R27 R28
#> 1 0 1 2 0 0 0 0 0 0 0 0 0
#> 2 0 0 0 1 0 0 0 0 0 0 0 0
#> 3 1 0 0 0 0 0 0 0 0 0 0 0
#> 4 0 0 0 0 0 0 1 3 11 1 1 0
#> 5 0 0 1 0 0 0 0 0 0 0 0 0
a$rankPc[1:5,]
#> Statistical unit Time R1 R2 R3 R4 R5 R6 R7 R8 R9
#> 1 Belgium 2001 0% 0% 0% 0% 0% 0% 0% 0% 0%
#> 2 Bulgaria 2001 0% 0% 0% 0% 0% 22.22% 16.67% 33.33% 5.56%
#> 3 Czech Republic 2001 0% 0% 0% 5.56% 38.89% 33.33% 0% 11.11% 0%
#> 4 Denmark 2001 0% 0% 5.56% 0% 0% 0% 0% 0% 0%
#> 5 Germany 2001 0% 5.56% 0% 0% 0% 0% 5.56% 5.56% 0%
#> R10 R11 R12 R13 R14 R15 R16 R17 R18 R19 R20 R21 R22
#> 1 11.11% 0% 5.56% 0% 50% 5.56% 11.11% 0% 5.56% 11.11% 0% 0% 0%
#> 2 5.56% 0% 0% 5.56% 0% 5.56% 0% 0% 0% 0% 5.56% 0% 0%
#> 3 5.56% 0% 0% 0% 0% 0% 0% 5.56% 0% 0% 0% 0% 0%
#> 4 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0%
#> 5 0% 16.67% 33.33% 27.78% 0% 0% 0% 0% 0% 5.56% 0% 0% 0%
#> R23 R24 R25 R26 R27 R28
#> 1 0% 0% 0% 0% 0% 0%
#> 2 0% 0% 0% 0% 0% 0%
#> 3 0% 0% 0% 0% 0% 0%
#> 4 5.56% 16.67% 61.11% 5.56% 5.56% 0%
#> 5 0% 0% 0% 0% 0% 0%
###to automatically store the two .csv files in the desired folder, use path:
#ranksCount(ranks2001, decim=0, path="E:/Sample folder")