pp_similarity {PolicyPortfolios} | R Documentation |
Calculate the similarity between different portfolios
Description
Calculate similarity between portfolios.
Usage
pp_similarity(D, id = NULL, method = "all", return_all = TRUE)
Arguments
D |
Data frame in a tidy format with the following columns: "Country", "Sector", "Year", "Instrument", "Target" and "covered". "covered" is a binary identificator of whether the portfolio space is covered by policy intervention (1) or not (0). The remaining columns identify the case. Notice that "Year" is a numeric value, while the remaining 4 case identifiers are factors. |
id |
A list with up to two elements, namely "Country", and "Year" indicating the specific identification characteristics of the portfolio(s) that must be processed. Defaults to NULL to process all portfolios. |
method |
A character vector containing the indices of similarity requested. Defaults to "all". The implemented indices of binary similarity are "jaccard" (), " |
return_all |
Logical indicating whether all possible combinations (countries and years of origin and destination) must be returned or only when they are different. Defaults to TRUE. |
Value
A tidy dataset containing the portfolio identificators (Country, Sector and Year) plus the similarity measures and their values.
Examples
## Not run:
data(P.education)
pp_similarity(P.education, id = list(Year = 2025))
## End(Not run)