# Tracking my weight using Org-mode and R

I record my weight nearly every day. My bathroom scale uploads the data to a couple of tracking sites, but I also record it in a CSV file, like this…

Date,Weight
2017-12-15,193.9
2017-12-14,193.3
2017-12-13,194.4
2017-12-12,195.8
2017-12-11,198.7
2017-12-08,196.7
2017-12-07,196.5
2017-12-06,197.6
2017-12-05,198.7
2017-12-04,201.4
2017-12-01,199.1
2017-11-30,199.2

I’ve always wanted to learn more about R, even though I generally have no need for it. And while it’s certainly overkill, I decided to graph my weight using R and Org-mode’s Babel mode.

First, I installed R via Homebrew

brew install R

Then I installed the ggplot2 and ggthemes packages in R

> install.packages(“ggplot2”)> install.packages(“ggthemes”)

In my org file I have the following:

#+BEGIN_SRC R :results output graphics :exports both :file ~/Dropbox/org/img/weight.png
library(ggplot2)
library(ggthemes)
data$Date <- as.Date(data$Date)
#+END_SRC