我正在使用 Org-mode 作为我的农业田间试验和博士论文的日志。
报告现场试验我想将试验的议程视图导出到组织表以获得类似这样的最终产品:(玩具数据)
| 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 | ... | ... | |
| ... | ... | ... | |
从 Ca m(TAG 搜索)我可以获得类似这样的内容(真实数据):
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::
编辑掉不必要的标签不是问题,我得到:(我添加了前三列的标题只是为了明确我的想法......)
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>
然后将此格式转换为组织表:
| 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 |
DAE 代表“出苗后天数”。我希望能够根据日期并按日期排序来计算“作物年龄”。议程中的格式是否适合计算?这实际上是一个额外的问题...
将数据转换为表格是一个问题(转换时没有标题,稍后我会添加)。我必须手动进行所有分离。有没有简单的方法可以将议程视图导出为组织表形式?组织议程的列视图是正确的路径吗?
答案1
我在 Org-mode 帮助页面找到了一个解决方案。链接如下:http://orgmode.org/manual/Scope-of-column-definitions.html 和 http://orgmode.org/manual/Capturing-column-view.html。
这样的 Org 列视图不可导出,但可以使用动态块进行捕获:
示例数据:
* Trial A
** Planting
<2014-02-28 Fri>
** Emergence
<2014-03-10 Mon>
** Biomass evaluation
<2014-04-29 Tue>
** Harvest
<2014-05-28 Wed>
我想要导出项目本身 ( %25ITEM
) 和日期 ( %TIMESTAMP
),因此我设置:
#+COLUMNS: %25ITEM %TIMESTAMP
Then one goes to the top header (Trial A) and uses:
C-c C-x i --- (org-insert-columns-dblock) ; I get
#+BEGIN: columnview :hlines 1 :id local
| ITEM | TIMESTAMP | |
|-----------------------+----------------+---|
| * Trial A | | |
| ** Planting | 2014-02-28 Fri | |
| ** Emergence | 2014-03-10 Mon | |
| ** Biomass evaluation | 2014-04-29 Tue | |
| ** Harvest | 2014-05-28 Wed | |
#+END:
(我添加了第三列)我可以轻松将其更改为我想要的输出(消除星号 + 更改标题)。添加第三列后,我也可以进行我想要的日期计算,如下所示:
#+TBLFM: $3 = date(<$2>) - date(<2012-10-21>)