org-mode/library-of-babel.org

1.8 KiB

The Library of Babel — off-the-shelf functions for data analysis and plotting using org-babel

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)

One Liner

Here's a different type of syntax that may work.

This uses one-liners of the form

#+lob:source-block-name variables

This takes advantage of the functionality already present in org-babel-ref for resolving references to other source blocks which may contain variable specifications. See the bottom half of org-babel-lob for the new implementation. To test it out load org-babel-lob and press C-cC-c on the #+lob: line further down.

0 0
plot(data)
1 2
2 4
3 9
4 16
5 25

#+lob:my-R-plot data=example-R-plot-data

Plotting code

Plot column 2 (y axis) against column 1 (x axis). Columns 3 and beyond, if present, are ignored.

0 0
plot(data)
plot(__data__)
plot(__data__)
org_babel_R_eoe
org_babel_R_eoe
79
79
78
77