Extract the points that make up the Pareto frontier from a set of data.

get_frontier(data, x, y, quadrant = c("top.right", "bottom.right",
  "bottom.left", "top.left"), decreasing = TRUE)

Arguments

data

A data frame.

x

A numeric vector.

y

A numeric vector.

quadrant

Chararacter string specifying which quadrant the frontier should appear in. Default is "top.right".

decreasing

Logical value indicating whether the data returned is in decreasing or ascending order (ordered by x and then y). Default is decreasing order.

Value

A data frame containing the data points that make up the efficient frontier.

See also

geom_frontier for plotting the Pareto front

Examples

# default will find the Pareto optimal observations in top right quadrant get_frontier(mtcars, mpg, wt)
#> mpg wt #> Toyota Corolla 33.9 1.835 #> Fiat 128 32.4 2.200 #> Merc 240D 24.4 3.190 #> Hornet 4 Drive 21.4 3.215 #> Pontiac Firebird 19.2 3.845 #> Merc 450SE 16.4 4.070 #> Chrysler Imperial 14.7 5.345 #> Lincoln Continental 10.4 5.424
# the output can be in descending or ascending order get_frontier(mtcars, mpg, wt, decreasing = FALSE)
#> mpg wt #> Lincoln Continental 10.4 5.424 #> Chrysler Imperial 14.7 5.345 #> Merc 450SE 16.4 4.070 #> Pontiac Firebird 19.2 3.845 #> Hornet 4 Drive 21.4 3.215 #> Merc 240D 24.4 3.190 #> Fiat 128 32.4 2.200 #> Toyota Corolla 33.9 1.835
# use quadrant parameter to change how you define the efficient frontier get_frontier(airquality, Ozone, Temp, quadrant = 'top.left')
#> Ozone Temp #> 120 76 97 #> 126 73 93 #> 40 71 90 #> 41 39 87 #> 97 35 85 #> 129 32 84 #> 95 16 82 #> 94 9 81 #> 76 7 80 #> 23 4 61 #> 21 1 59
get_frontier(airquality, Ozone, Temp, quadrant = 'bottom.right')
#> Ozone Temp #> 117 168 81 #> 30 115 79 #> 139 46 78 #> 1 41 67 #> 17 34 66 #> 24 32 61 #> 8 19 59 #> 15 18 58 #> 18 6 57