0

(still a complete beginner to org in general)

I managed to setup org-habit, that also feeds into org-agenda to neatly see habits. I would like to track a few variables that go along with my habits (e.g. track my weight).

I see 2 options:
1. add notes via the :LOGGING: property
2. create a custom property (?)

How can I track variable values over time?

  • 1
    Not sure I understand what you want to do: e.g. would a table of values work? You have one column for the date and one column each for the variables you want to track. The question is: what do you want to do with these values? – NickD Jun 5 at 23:50
  • @NickD thanks for reaching out! good question, I saw that you can easily make a table to visualize consistency, but simply having done the habit, doesn't always mean I made an improvement (reduce weight, running track, lifting weights..) - I want them as easily "query-able" as possible. e.g. linegraph of weight over time. – user57623 Jun 6 at 12:51
  • Then it seems to me that a table of values plus some code blocks to do the plotting you need would do the job. No time now to attempt an implementation, but if nobody beats me to it, I may be back later on :-) – NickD Jun 6 at 14:20
  • @NickD if you show me how to query the data, that would be plenty (I can program in other languages, but have never touched lisp). I guess the question is more 1. how you best input such data in org-mode and 2. how you would query such data later on (e.g. for plotting). Would be great if data input is similar/seamless as completing normal todos. – user57623 Jun 6 at 14:30
  • Data input is going to be the hardest I think: I don't know of a way to do it the way you want. But... baby steps. – NickD Jun 6 at 14:48
3

I have an Org capture template that tracks weight. It is a sub-capture under "health". The relevant snippet for the capture template is:

    ("h" "Health")
    ("hW" "Weight" 
     table-line (id "ID-TBL-WEIGHT") "|%?|%u|"  :unnarrowed t)

And then I have a table that collects the data:

:PROPERTIES:
:ID:       ID-TBL-WEIGHT
:END:
#+NAME: weights
| Weight (lbs) | Date             | Note                     | Offset |
|--------------+------------------+--------------------------+--------|
|          142 | [2013-03-25 Mon] |                          |        | 
|          144 | [2020-06-06 Sat] |                          |        |

The idea being it is easy to log weight on any given date, take notes (e.g. "pre/post some travel, sickness, exercise, diet, etc.") and even offsets if you switch scales and need to adjust for something.

Elsewhere, graph it with Org babel blocks. I use jupyter-python but Gnuplot or the built-in Org graphing should all work roughly the same. In all cases, in the #+BEGIN_SRC header you'll want to have :var w=weights (from the #+NAME: wegihts line).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.