Learn R Programming

colleyRstats (version 0.0.1)

add_pareto_emoa_column: Add Pareto EMOA Column to a Data Frame

Description

This function calculates the Pareto front for a given set of objectives in a data frame and adds a new column, PARETO_EMOA, which indicates whether each row in the data frame belongs to the Pareto front.

Usage

add_pareto_emoa_column(data, objectives)

Value

A data frame with the same columns as data, along with an additional column, PARETO_EMOA, which is TRUE for rows that are on the Pareto front and FALSE otherwise.

Arguments

data

A data frame containing the data, including the objective columns.

objectives

A character vector specifying the names of the objective columns in data. These columns should be numeric and will be used to calculate the Pareto front.

Examples

Run this code
# Define objective columns
objectives <- c("trust", "predictability", "perceivedSafety", "Comfort")

# Example data frame
main_df <- data.frame(
  trust = runif(10),
  predictability = runif(10),
  perceivedSafety = runif(10),
  Comfort = runif(10)
)

# Add the Pareto front column
main_df <- add_pareto_emoa_column(data = main_df, objectives)
head(main_df)

Run the code above in your browser using DataLab