descStats_scores_ranks.Rd
Computes average, median, stdev, and coefficient of variation for ranks or scores from multiple simulations. Returns master file with initial rank (score), followed by average and median one for each statistical unit and each period.
descStats_scores_ranks(x, path, time = c(0), decim = 2)
A list containing one or multiple dataframes (one for each year) with the ranks (scores) for different simulations. The dataframes inside the list have to look like the ones 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 (scores) in simulations.
Specifies the path to the folder where the returned .csv files ("Master file", "Average", "Median", "Stdev", "CV") are to be saved.
A vector of the time periods for each dataframe in list x. Default is c(0).
Numeric. Specifies the number of decimals to display. Default is 2.
If path is missing, it returns a list of five data frames (masterFile, x_average, x_median, x_stdev, x_CV). If path is specified, it also writes five .csv files ("Master file", "Average", "Median", "Stdev", "CV") in the path folder. Countries are written in column 1. Time is written as colnames.
###example for one year
ranks2001[1:5,1:5]
#> Statistical.unit Time S0 S1 S2
#> 1 Belgium 2001 14 15 14
#> 2 Bulgaria 2001 8 7 8
#> 3 Czech Republic 2001 5 4 6
#> 4 Denmark 2001 25 25 25
#> 5 Germany 2001 13 11 12
dataTestList=list(ranks2001)
a=descStats_scores_ranks(dataTestList,
#path="E:/Sample folder"
)
a$masterFile
#> 0
#> Belgium "14 (Avg=14.5; Me=14)"
#> Bulgaria "8 (Avg=8.89; Me=8)"
#> Czech Republic "5 (Avg=6.56; Me=6)"
#> Denmark "25 (Avg=23.67; Me=25)"
#> Germany "13 (Avg=11.44; Me=12)"
#> Estonia "7 (Avg=7.78; Me=7)"
#> Ireland "12 (Avg=11.39; Me=12)"
#> Greece "22 (Avg=21.72; Me=22)"
#> Spain "6 (Avg=7.22; Me=6)"
#> France "11 (Avg=10.83; Me=11)"
#> Croatia "28 (Avg=28; Me=28)"
#> Italy "16 (Avg=16.06; Me=16)"
#> Cyprus "18 (Avg=17.39; Me=17.5)"
#> Latvia "21 (Avg=20.17; Me=21)"
#> Lithuania "23 (Avg=23.06; Me=23)"
#> Luxembourg "15 (Avg=15.78; Me=15.5)"
#> Hungary "26 (Avg=25.83; Me=26)"
#> Malta "9 (Avg=9.44; Me=9.5)"
#> Netherlands "20 (Avg=19.06; Me=20)"
#> Austria "10 (Avg=10.11; Me=10)"
#> Poland "17 (Avg=17.33; Me=17)"
#> Portugal "3 (Avg=3.33; Me=3)"
#> Romania "1 (Avg=1.06; Me=1)"
#> Slovenia "19 (Avg=18.39; Me=19)"
#> Slovakia "24 (Avg=23.94; Me=24)"
#> Finland "4 (Avg=4.39; Me=4)"
#> Sweden "27 (Avg=26.39; Me=27)"
#> United Kingdom "2 (Avg=2.28; Me=2)"
###example for multiple years
names(ranks2001_2003)
#> [1] "ranks2001" "ranks2002" "ranks2003"
a=descStats_scores_ranks(ranks2001_2003, time=c(2001, 2002, 2003), decim=4)
a$masterFile[1:5,]
#> 2001 2002
#> Belgium "14 (Avg=14.5; Me=14)" "14 (Avg=14.1111; Me=14)"
#> Bulgaria "8 (Avg=8.8889; Me=8)" "9 (Avg=9.3889; Me=8)"
#> Czech Republic "5 (Avg=6.5556; Me=6)" "6 (Avg=7.6111; Me=6.5)"
#> Denmark "25 (Avg=23.6667; Me=25)" "25 (Avg=23.7222; Me=25)"
#> Germany "13 (Avg=11.4444; Me=12)" "11 (Avg=10.4444; Me=11)"
#> 2003
#> Belgium "14 (Avg=14.1667; Me=14)"
#> Bulgaria "9 (Avg=9.7222; Me=8)"
#> Czech Republic "6 (Avg=6.9444; Me=6)"
#> Denmark "24 (Avg=22.6667; Me=24)"
#> Germany "12 (Avg=11.3889; Me=12)"
a$x_stdev[1:5,]
#> 2001 2002 2003
#> Belgium "2.5029" "2.2981" "2.0934"
#> Bulgaria "3.6604" "3.9279" "3.7386"
#> Czech Republic "2.9748" "3.0705" "3.0577"
#> Denmark "5.2244" "4.9918" "4.9705"
#> Germany "3.3646" "2.8947" "2.9732"