[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Strings converted to numbers in Org table?
From: |
Alan Schmitt |
Subject: |
Re: [O] Strings converted to numbers in Org table? |
Date: |
Tue, 28 Feb 2017 08:43:49 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (darwin) |
On 2017-02-27 10:17, "Charles C. Berry" <address@hidden> writes:
> IMHO, it is often best to handle formatting of output in the language of
> the src block. There are some tools for doing this in R: the `ascii'
> package is one. `xtable' is another.
I've had the same problem when working with tables and ocaml, as the
latter requires everything in the table to have the same type, so I need
to make sure everything is a string. To work around this, I did the
following:
#+name: convert-table
#+BEGIN_SRC emacs-lisp :var data=tps
(mapcar (lambda (row)
(mapcar (lambda (cell)
(if
(numberp cell)
(number-to-string cell)
cell))
row))
data)
#+END_SRC
#+BEGIN_SRC ocaml :var data=convert-table :results output raw
(* ocaml code *)
#+END_SRC
Best,
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2017-01: 406.13, 2016-01: 402.52
signature.asc
Description: PGP signature