Skip to contents

This function filters recipes based on specified minimum and maximum preparation and cooking times.

Usage

filter_by_time(
  data,
  min_prep_time = 0,
  max_prep_time = Inf,
  min_cook_time = 0,
  max_cook_time = Inf
)

Arguments

data

Data frame containing the recipes.

min_prep_time

Minimum allowed preparation time in minutes (default is 0).

max_prep_time

Maximum allowed preparation time in minutes (default is Inf).

min_cook_time

Minimum allowed cooking time in minutes (default is 0).

max_cook_time

Maximum allowed cooking time in minutes (default is Inf).

Value

A data frame of recipes filtered by the specified time constraints.

Examples

filter_by_time(data = recipes, min_prep_time = 10, max_prep_time = 30,
               min_cook_time = 20, max_cook_time = 60)
#> # A tibble: 4,049 × 10
#>    recipe_title      rating description cuisine course diet  prep_time cook_time
#>    <chr>              <dbl> <chr>       <chr>   <chr>  <chr>     <dbl>     <dbl>
#>  1 Thakkali Gotsu R…   4.93  also know… South … Lunch  Vege…        10        20
#>  2 Rajma Kofta In M…   4.83 Koftas are… North … Side … High…        20        30
#>  3 Barnyard Millet …   4.90 is a flavo… Indian  Lunch  Vege…        10        30
#>  4 Karnataka Style …   4.87 Karnataka … Karnat… South… Vege…        10        30
#>  5 Schezwan Style C…   4.93 Love samos… North … Snack  Vege…        10        45
#>  6 Pineapple Upside…   4.78 The Classi… Contin… Desse… Vege…        20        40
#>  7 Toffee Banana Re…   4.87 Toffee ban… Chinese Desse… Vege…        10        60
#>  8 Kurkuri Bhindi A…   4.62 Kurkuri Bh… North … Lunch  Vege…        15        45
#>  9 Kela Matar ki Sa…   4.94 Kela Matar… North … Lunch  No O…        15        20
#> 10 Creamy Chicken P…   4.90 The   is a… Italia… Dinner High…        10        20
#> # ℹ 4,039 more rows
#> # ℹ 2 more variables: ingredients <chr>, instructions <chr>