rate_DF | R Documentation |
Count data frame's row rate according to several variables
rate_DF( data, rate.var, weights, return = "add", as.percent = FALSE, percent.var, digits = 2 )
data |
data frame with rated variables |
rate.var |
character; vector of data frame column names with numeric variables of range (0-1) that should be used for rating |
weights |
numeric; vector of variables' weights (their sum must be 1) |
return |
character; return object; possible values are: |
as.percent |
logical; if some rated variables are percentages |
percent.var |
character; vector of data frame column names with rated variables that are percentages |
digits |
integer; number of decimal places to round the rate value |
This function counts rate as rate = var1*weight1 + var2*weight2 + var3*weight3 +...
etc.
All variables must be in range (0-1) and sum of weights must be 1. If you use percentages as rating variable, use as.percent = TRUE
.
Those variables would be divided by 100 before rating and then would be multiplicated by 100 after rating.
rate.var
and percent.var
must be exact column names as in data frame.
Vector or data frame with rate values.
Elena N. Filatova
data <- data.frame (N = 1:5, percent = c(12, 15, 18, 20, 94), number = c(0.1, 0.5, 0.6, 0.8 ,0.9)) rate_DF (data = data, rate.var = c("percent", "number"), weights = c(0.4, 0.6), return = "add", as.percent = TRUE, percent.var = "percent")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.