Learn R Programming

convergEU (version 0.7.3.2)

country_ranking: Ranking of EU countries by time

Description

Countries are ranked for each time according to two types of indicators: higher is the best (highBest) or lower is the best (lowBest).

Usage

country_ranking(
  myTB,
  timeName = "time",
  time_0 = NA,
  time_t = NA,
  typeInd = "highBest"
)

Value

a list with component res which contains ranking by each considered year

Arguments

myTB

the dataframe time by countries (complete and sorted by increasing time).

timeName

the name of the variable that contains time information.

time_0

starting time to consider; if NA all times considered.

time_t

last time to consider; if NA all times considered.

typeInd

"highBest" is the default, "lowBest" is the alternative

References

https://www.eurofound.europa.eu/system/files/2022-04/introduction-to-the-convergeu-package-0.6.4-tutorial-v2-apr2022.pdf

Examples

Run this code

# Example 1
# Sorted dataframe in the format years by countries:
require(tibble)
myTB  <- tibble::tribble(
~years, ~UK, ~DE, ~IT,
1988,   1201, 868, 578,
1989,   1150, 978, 682,
1990,   998,  1250, 332,
1991,  1600,  1350, 802
)

# Country ranking according to the indicator higher is the best:
res <- country_ranking(myTB,timeName="years")

# Country ranking according to the indicator lower is the best:
res1 <- country_ranking(myTB,timeName="years", typeInd="lowBest")

# Country ranking for some years only:
myres <- country_ranking(myTB,timeName="years", time_0=1989,time_t=1990,typeInd="lowBest" )

# Example 2
# Ranking of the Member States for the "emp_20_64_MS" dataset
data(emp_20_64_MS)
myCR<-country_ranking(emp_20_64_MS,timeName = "time", time_0 = 2007, time_t = 2010)

# Visualize the results for the first five countries:
myCR$res[1:6]


Run the code above in your browser using DataLab