Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing org-mode to structure an analysis
    primarykey
    data
    text
    <p>I am trying to make better use of org-mode for my projects. I think literate programming is especially applicable to the realm of data analysis and org-mode lets us do some pretty awesome literate programming. </p> <p>I think most of you will agree with me that the workflow for writing an analysis is different than most other types of programming. I don't just write a program, I explore the data. And, while many of these explorations are dead-ends, I don't want to delete/ignore them completely. I just don't want to re-run them every time I execute the org file. I also tend to find or develop chunks of useful code that I would like to put into an analytic template, but some of these chunks won't be relevant for every project and I'd like to know how to make org-mode ignore these chunks when I am executing the entire buffer. Here's a simplified example.</p> <pre><code>* Import - I want org-mode to ignore import-sql. #+srcname: import-data #+begin_src R :exports none :noweb yes &lt;&lt;import-csv&gt;&gt; #+end_src #+srcname: import-csv #+begin_src R :exports none data &lt;- read.csv("foo-clean.csv") #+end_src #+srcname: import-sql #+begin_src R :exports none library(RSQLite) blah blah blah #+end_src * Clean - This is run on foo.csv, producing foo-clean.csv - Fixes the mess of -9 and -13 to NA for my sanity. - This only needs to be run once, and after that, reference. - How can I tell org-mode to skip this? #+srcname: clean-csv #+begin_src sh :exports none sed ..... #+end_src * Explore ** Explore by a factor (1) - Dead end. Did not pan out. Ignore. - Produces a couple of charts showing there is not interaction. #+srcname: explore-by-a-factor-1 #+begin_src R :exports none :noweb yes #+end_src ** Explore by a factor (2) - A useful exploration that I will reference later in a report. - Produces a couple of charts showing the interaction of my variables. #+srcname: explore-by-a-factor-2 #+begin_src R :exports none :noweb yes #+end_src </code></pre> <p>I would like to be able to use org-babel-execute-buffer and have org-mode somehow know to skip over the code blocks import-sql, clean-csv and explore-by-a-factor-1. I want them in the org file, because they are relevant to the project. After-all, tomorrow someone might want to know why I was so sure explore-by-a-factor-1 was not useful. I want to keep that code around, so I can bang out the plot or the analysis or what-ever and go on, but not have it run every-time I rerun everything because there's no reason to run it. Ditto with the clean-csv stuff. I want it around, to document what I did to the data (and why), but I don't want to re-run it every time. I'll just import foo-clean.csv.</p> <p>I Googled all over this and read a bunch of org-mode mailing list archives and I was able to find a couple of ideas, but not what I want. EXPORT_SELECT_TAGS, EXPORT_EXCLUDE_TAGS are great, when exporting the file. And the :tangle header works well, when creating the actual source files. I don't want to do either of these. I just want to execute the buffer. I would like to be able to define code blocks in a similar fashion to be executed or ignored. I guess I would like to find a way to have an org variable such as:</p> <p>EXECUTE_SELECT_TAGS</p> <p>This way I could simply tag my various code blocks and be done with it. It would be even nicer if I could then run the file, using only source blocks with specific tags. I can't find a way to do this and I thought I would ask before asking/begging for a new feature in org-mode.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload