The Calorie-Burner Shiny App

mjfii
2015-01-20

How Long Does it Take To Burn-off a Hamburger?

The Calorie-Burner Shiny App lets you accomplish 3 things:

  1. Understand which types of physical activity are the most arduous,
  2. Understand how long you need to conduct the activity based on your weight, and
  3. What percentage of common restaurant hamburgers are 'burned' based on the prior two items.

Calorie-Burner Algorithm

lbs2kg<-function(pounds) {pounds/2.2;}

getmets<-function(activity) {
  switch(activity,
         'Watching TV'=1,
         'Reading'=1.3,
         'Walking'=3.25,
         'Sking'=5,
         'Jogging'=7);
}

getcalories<-function(weight,activity,duration) {
  x<-lbs2kg(weight)
  y<-getmets(activity)
  z<-duration/60
  x*y*z
}

Calorie-Burner Algorithm Example

The app has 3 very simple inputs, and using the prior three functions, the algorithm can determine estimate calories burned. In order calculate calories, we can use the below example:

getcalories(150,'Walking',90)
[1] 332.4

or, another example:

getcalories(225,'Jogging',60)
[1] 715.9

Calorie-Burner - Percent of Hamburger Burned Example

Using the prior first example, we get the below graphic. For example, the 322 calculated calories burns off approximately 61% of a Big Mac.

alt text