Learn R Programming

valueprhr (version 0.1.0)

safe_mae: Safe MAE Calculation

Description

Calculates Mean Absolute Error handling non-finite values.

Usage

safe_mae(actual, predicted)

Value

A single numeric value for MAE, or NA if calculation not possible.

Arguments

actual

Numeric vector of actual values.

predicted

Numeric vector of predicted values.

Examples

Run this code
actual <- c(1, 2, 3, 4, 5)
predicted <- c(1.1, 2.2, 2.9, 4.1, 5.2)
safe_mae(actual, predicted)

Run the code above in your browser using DataLab