Function: sort_recipes
sort_recipes.Rmd
Overview
The sort_recipes
function in the
Mealsuggestor
package enables users to sort recipes based
on a specified criterion, such as rating or preparation time. This
functionality is essential for organizing recipes according to specific
needs or preferences.
Parameters
-
data
: A data frame containing the recipes. -
sort_by
: The column name to sort by (e.g., “rating”, “prep_time”). -
ascending
: ifTRUE
, sorts in ascending order, else in descending order. Default isTRUE
.
Example Usage
The following example demonstrates how to use the
sort_recipes
function to sort recipes by rating in
descending order:
library(Mealsuggestor)
sorted_recipes <- sort_recipes(data = recipes, sort_by = "rating", ascending = FALSE)
# Display the sorted recipes
print(sorted_recipes)