profile_of_rankings: Create Profile of Rankings

View source: R/por.R

profile_of_rankingsR Documentation

Create Profile of Rankings

Description

'profile_of_rankings()' creates a profile of rankings. These profile of rankings will be useful for all the functions implementing ranking rules

# PROFILE OF RANKINGS:
ranking – numberOfVoters – candidate1 – candidate2 ...
1 .. rankingpos rankingpos ...
2 .. rankingpos rankingpos ...

Usage

profile_of_rankings(
  matrix = NULL,
  numberOfVoters = NULL,
  candidates = NULL,
  ties = NULL
)

Arguments

matrix

matrix where each row reperesents a ranking or vector where the candidates for each ranking are listed row by row

numberOfVoters

the number of voters for each row

candidates

the names of the candidates

ties

boolean vector for representing ties when we are using indexes for the matrix with the ranking

Value

A dataframe containing all the data needed to work with a profile of rankings

# Create a profile of rankings (recommended way) profileOfRankings <- profile.of.rankings(candidates = c('a','b','c','d')) profileOfRankings <- add.ranking(profileOfRankings, c('c','b','a','d'), votes = 6) profileOfRankings <- add.ranking(profileOfRankings, c('a','d','b','c'), votes = 5) profileOfRankings <- add.ranking(profileOfRankings, c('b','a','d','c'), votes = 3)

# Using the first parameter as vector profileOfRankings <- profile.of.rankings( c('a','b','c','d', 'a','d','b','c', 'd','a','c','b'), candidates = c('a','b','c','d'))


noeliarico/consensus documentation built on March 18, 2023, 12:37 p.m.