**R-Chart**, and kindly contributed to R-bloggers)

Physical fitness has become increasingly technical and data driven. I started running a bit in the last few months and have been delving into the prevailing wisdom related to assessing ones health as a baseline for pursuing various fitness goals. Some of the terms related to tracking a heart rate gave me visions of white lab coats, cardiac monitors and sophisticated formulas based upon years of scientific analysis. And while there may be truth to this, the practical reality is quite a bit simpler.

In many workout routines, a target heart rate is calculated which is supposed to identify a range (usually in beats per minute) during an exercise routine that will provide optimal cardiovascular value. The basic idea is that you want a work out that is rigorous enough to derive a benefit from the exercise without harming your body. It is appealing in that it provides an objective measure to evaluate your workout. And once your workout can be measured, it is possible to set goals and work to improve your heath.

What is implied in the idea of a target heart rate is that there is some upper limit that cannot safely be exceeded. You might think that you need to be hooked up to a bunch of cardiac sensors to find out this value – and although this might be optimal, it is not the technique used by most folks. Instead, there are relatively simple formulas that are used to calculate a maximum heart rate for an individual. They are usually based only upon age (although some calculations consider gender as well).

Maximum Heart Rate CalculationsVarious formulas (most of them simple linear formulas at that) have been devised to estimate individual Maximum Heart Rates. However actual maximum heart rates vary significantly between individuals based upon physiology, physical fitness and other factors so the value of the metric is disputed. Nevertheless, I was interested in comparing the available formulas to get a sense of a range (based upon “ensembling” if you will) of what is being reported or suggested by health sites, software and machines that use this value. One of the gizmos I have begun using is the Garmin GPS with heart rate monitor. I am impressed with its performance so far. It includes its own software that does most of the types of data aggregation and summary that you would like – but I look forward to geeking out and seeing what can be done with the data in R in later posts. |

**Method**

A ruby script was used to create a semicolon delimited file with the maximum heart rate from ages 18 through 90 for various calculation methods described in the Wikipedia article. The resulting data can be read into an R script to produce the charts in this blog.

A summary that combines the calculations combined does not make a whole lot of sense since two of the calculations in use are for women only and one is for men only. However, all of the techniques fit within a relatively narrow range (since we human beings aren’t quite that random). Besides, the two calculations for women are among the most divergent presented, and so cancel each other out in part (though they probably pull down the average for they younger and older ends of the spectrum).

There are a number of possibilities for using R with fitness devices that provide heart rate information, geographic data, time, distance, caloric intake and consumption, etc. I was was not able to find much in the way of open source fitness related calculation software APIs – so this could be an new area for R developers to address. (It also provides some balance to the relatively sedentary life of developing and blogging).

**leave a comment**for the author, please follow the link and comment on his blog:

**R-Chart**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...