Extract the score columns from a data frame scored using apply_scores()
.
Arguments
- df
The scored data frame.
- scores
A data frame of score specifications. See scores_init.
- final_score
Whether the data frame has been given a final score by
score_final()
.
Examples
data <- tibble::tibble(
x = 1:10
)
scores <- create_score(
scores_init,
score_type = "Linear", colname = "x", score_name = "Default",
weight = 1, lb = 1, ub = 6, exponential = FALSE
)
scores <- create_score(
scores,
score_type = "Peak", colname = "x", score_name = "Peak score",
weight = 2, lb = 2, ub = 8, centre = 5, inverse = FALSE,
exponential = FALSE
)
scored <- apply_scores(data, scores)
scored <- score_final(scored, scores)
get_scores(scored, scores)
#> # A tibble: 10 × 3
#> `Score 1: x` `Peak score` final_score
#> <dbl> <dbl> <dbl>
#> 1 0 0 0
#> 2 0.2 0 0.0667
#> 3 0.4 0.333 0.356
#> 4 0.6 0.667 0.644
#> 5 0.8 1 0.933
#> 6 1 0.667 0.778
#> 7 1 0.333 0.556
#> 8 1 0 0.333
#> 9 1 0 0.333
#> 10 1 0 0.333