utilsCalculateDistance {rSRD} | R Documentation |
utilsCalculateDistance
Description
Calculates the Manhattan-distance between two rankings and inserts it into the DataFrame after the first column.
Usage
utilsCalculateDistance(df, nameCol, refCol)
Arguments
df |
A DataFrame. |
nameCol |
The current Column of the iteration. |
refCol |
The reference Column of the dataFrame. |
Value
Returns a new df
that has a Distance Column based on the nameCol
.
Author(s)
Ali Tugay Sen
Examples
SRDInput <- data.frame(
A=c(32, 52, 44, 44, 47),
B=c(73, 75, 65, 76, 70),
C=c(60, 59, 57, 55, 60),
D=c(35, 24, 44, 83, 47),
E=c(41, 52, 46, 50, 65))
nameCol <- "A"
refCol <- "B"
for(i in names(SRDInput)){ SRDInput <- rSRD::utilsCalculateRank(SRDInput,i)}
rSRD::utilsCalculateDistance(SRDInput,nameCol,refCol)
[Package rSRD version 0.1.7 Index]