Learn R Programming

JDCruncheR (version 0.3.5)

weighted_score: Weighted score calculation

Description

Function to weight a pre-calculated score

Usage

weighted_score(x, pond = 1L)

Value

the input with an additionnal weighted score

Arguments

x

a QR_matrix or mQR_matrix object

pond

the weights to use. Can be an integer, a vector of integers, the name of one of the quality report variables or a list of weights for the mQR_matrix objects.

See Also

Traduction française

Other QR_matrix functions: export_xlsx(), export_xlsx.QR_matrix(), export_xlsx.mQR_matrix(), extract_QR(), rbind.QR_matrix(), sort()

Examples

Run this code
# Path of matrix demetra_m
demetra_path <- file.path(
    system.file("extdata", package = "JDCruncheR"),
    "WS/ws_ipi/Output/SAProcessing-1",
    "demetra_m.csv"
)

# Extract the quality report from the demetra_m file
QR <- extract_QR(demetra_path)

# Compute the score
QR <- compute_score(QR, n_contrib_score = 2)

# Weighted score
QR <- weighted_score(QR, 2)
print(QR)

# Extract the weighted score
QR[["modalities"]][["score_pond"]]

Run the code above in your browser using DataLab