org-mode/library-of-babel.org

50 lines
985 B
Org Mode

#+title: The Library of Babel --- off-the-shelf functions for data analysis and plotting using org-babel
#+SEQ_TODO: TODO PROPOSED | DONE DEFERRED REJECTED
#+OPTIONS: H:3 num:nil toc:t
#+STARTUP: odd hideblocks
[[http://downlode.org/Etext/library_of_babel.html][Full text of the Borges short story]]
(setq lob (org-babel-lob-parse-buffer))
(setq x (gethash 'plot lob))
(hash-table-count lob)
(maphash (lambda (key val) (insert key)) lob)
* Plotting code
Plot column 2 (y axis) against column 1 (x axis). Columns 3 and beyond, if present, are ignored.
#+srcname: R-plot(data=R-plot-example-data)
#+begin_src R :session *R*
plot(data)
"R plot complete"
#+end_src
#+tblname: R-plot-example-data
| 1 | 2 |
| 2 | 4 |
| 3 | 9 |
| 4 | 16 |
| 5 | 25 |
#+lob: R-plot(data=R-plot-example-data)
#+tblname: XX
| 1 | 1 |
| 2 | .5 |
| 3 | .3333 |
| 4 | .25 |
| 5 | .2 |
| 6 | .1666 |
| 7 | 0.1428 |
#+srcname: python-identity(a=5)
#+begin_src python
a
#+end_src