I’m a bit of a nutrition nerd. I wanted to analyze some recipes that I cook a lot just because I’m curious. So in order to move in that direction, I decided to write a package,
nutritionR, that can perform a nutritional analysis of foods and recipes expressed in natural language.
nutritionR is a wrapper for the Nutritionix API. Nutritionix caught my attention because it goes beyond a lot of the free nutritional analysis tools that I’ve seen by supporting lots of micronutrients. Using
nutritionR, it’s possible to check 68 different nutrients, including the usual suspects: fats, carbs, protein, calories – but also things like choline, lycopene, vitamin d, vitamin b12, etc…
I wrote this package to support nutrition analysis of meals. You can enter one or more ingredients or food items and then search for a specific nutrient like this:
obj <- nutritionix_lookup("I had eggs and toast for breakfast, and a burrito for lunch.") nutrient(obj, "calories") $name  "calories" $amount  569.1 $unit  "kcal"
It can also be used to analyze recipes, by entering a comma-separated ingredients list like this:
obj <- nutritionix_lookup("2 cups red lentils, 2 tsps turmeric, 4 tbsp olive oil, 2 tsps cumin seeds, 1 small onion, 2 cloves garlic, 2 fresh green chiles, 1 tsp garam masala, 1 tsp ground coriander, 1 tbsp fresh ginger, 2 medium tomatoes") nutrient(obj, "calories") $name  "calories" $amount  2022.532 $unit  "kcal"