3
1
I'm using Org-mode is the log-book for my agricultural field trials and my Phd thesis in general.
Reporting field trials I would like to export the agenda views of trials to org-tables to get something like this as a final product: (Toy data)
| Trial | Date (Toy data) | Action | DAE |
|---------+-------------------+-----------------------+-----|
| Trial A | <2013-02-21 Thu> | Planting | |
| Trial A | <2013-03-03 Sun> | Emergence | 0 |
| Trial A | <2013-04-19 Fri> | Fungicide Application | 7 |
| Trial A | <2013-05-20 Mon> | Biomass Evaluation | 50 |
| Trial A | <2013-06-21 Fri> | Harvest | 110 |
| Trial B | ... | ... | |
| ... | ... | ... | |
From the C-a m (TAG search) I can get something like this here (real data):
13pgSoja: 13pgSoja: Planting: Soybean <2012-11-06 Tue> :NPW:2013:PG::
13pgSoja: 13pgSoja: Emergence <2012-11-14 Thu> :NPW:2013:PG::
13pgSoja: 13pgSoja: Application 1 <2012-11-22 Thu 14:30-16:30> :NPW:2013:PG::
13pgSoja: 13pgSoja: Evaluation: Control 1 <2012-11-28 Wed> :NPW:2013:PG::
13pgSoja: 13pgSoja: Evaluation: Biomass Weeds <2013-02-18 Mon> :NPW:2013:PG::
13pgSoja: 13pgSoja: Evaluation: Biomass Soybean :NPW:2013:PG::
13pgSoja: 13pgSoja: Harvest <2013-03-25 Mon> :NPW:2013:PG::
Editing away unnecessary tags is not a problem, I get: (I added the header for the three first columns just to make clear my idea...)
Trial Action Date
13pgSoja: Planting: Soybean <2012-11-06 Tue>
13pgSoja: Emergence <2012-11-14 Thu>
13pgSoja: Application 1 <2012-11-22 Thu 14:30-16:30>
13pgSoja: Evaluation: Control 1 <2012-11-28 Wed>
13pgSoja: Evaluation: Biomass Weeds <2013-02-18 Mon>
13pgSoja: Evaluation: Biomass Soybean
13pgSoja: Harvest <2013-03-25 Mon>
Then converting this format to an org-table:
| Trial | Action | Date | DAE |
| 13pgSoja: | Planting: Soybean | <2012-11-06 Tue> | |
| 13pgSoja: | Emergence | <2012-11-14 Thu> | 0 |
| 13pgSoja: | Application 1 | <2012-11-22 Thu> | |
| 13pgSoja: | Evaluation: Control 1 | <2012-11-28 Wed> | |
| 13pgSoja: | Evaluation: Biomass Weeds | <2013-02-18 Mon> | |
| 13pgSoja: | Evaluation: Biomass Soybean | <2013-02-18 Mon> | |
| 13pgSoja: | Harvest | <2013-03-25 Mon> | 130 |
The DAE stands for "Days after emergence". I would like to be able to calculate the "crop age" from the dates and sorting by date. Is the format from the agenda any good for calculations? This is actually an additional question...
Converting data to a table is a problem (converting without header, that I would add later). I would have to do the seperations all manually. Is there any easy way to export the agenda view into an org-table form? Is column view of org-agenda the right path?
It's hard to see how the the tags you have relate to the table. I see data in the table that I don't see in the tags. Would you be able to provide small portion of data, and a equivalent table? – Alex McKenzie – 2014-04-25T19:09:30.223
Here you go Alex; added some more data and desired output table – mcg – 2014-04-25T20:57:48.527
Don't really see the required transformation, but awk is your friend (along with cut). By default, awk reads each line of an input file, splits it into fields using the delimiters or fixed length fields of your choice and then matches each line against successive patterns (that you specify). When a pattern matches, then the action associated with that pattern is invoked. It's perfect for restructuring and cleaning data. – Joe – 2014-05-06T06:13:57.347