star_rating {votesys} | R Documentation |
User Preference Aggregation
Description
The function uses a simple method to calculate the aggregation scores of user ratings, which is described in Langville, A. and Meyer, C. (2012: 128). Input data can be stored in a sparse matrix. Suppose there are 100 films and users are required to assign scores. However, each user only watched several of them. Thus, when comparing two films A and B, the method only takes account ratings from those who watched both A and B.
Usage
star_rating(x, show_name = FALSE, check_na = TRUE)
Arguments
x |
a numeric matrix, or, |
show_name |
the default is FALSE, that is to say, the function does not store and show candidate names in the result and you cannot see them. However, you can set it to TRUE. |
check_na |
if it is TRUE, the function will check NAs and convert
them to 0s. If NAs do exist and |
Value
a list object.
(1)
call
the function call.(2)
method
the counting method.(3)
candidate
candidate names. Ifshow_name
is FALSE, this will be NULL.(4)
candidate_num
number of candidate.(5)
ballot_num
number of ballots in x.(6)
valid_ballot_num
number of ballots that are used to compute the result.(7)
winner
the winner. Ifshow_name
is FALSE, this only shows the number in1: ncol(x)
.(8)
winner_score
the winner's score, which is the highest score.(9)
other_info
scores of all the candidates.
References
Langville, A. and Meyer, C. 2012. Who's #1? The Science of Rating and Ranking. Princeton University Press, p. 128.
Examples
# Example from Langville and Meyer, 2012: 128.
# 4 films are rated by 10 users; 0 means no score.
raw <- c(4, 3, 1, 2, 0, 2, 0, 3, 0, 2, 2, 1, 0, 4, 3, 3, 4,
1, 3, 0, 2, 0, 2, 2, 2, 0, 1, 1, 2, 2, 0, 2, 0, 0, 5, 0, 3,
0, 5, 4
)
m <- matrix(raw, ncol = 4)
colnames(m) <- paste("film", 1: 4, sep = "")
y <- star_rating(m, show_name = TRUE) # winner is film4