country_ranking: Ranking of EU countries by time

View source: R/country_ranking.R

country_rankingR Documentation

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"
)

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

Value

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

References

https://unimi2013-my.sharepoint.com/:u:/g/personal/federico_stefanini_unimi_it/EW0cVSIgbtZAvLPNbqcxdX8Bfn5VGSRHfAH88hQwc_RIEQ?e=MgtSZu

Examples


# 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]



convergEU documentation built on March 7, 2023, 7:22 p.m.