From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: "Charles C. Berry" <ccberry@ucsd.edu>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>,
Vicente Vera <vicentemvp@gmail.com>
Subject: Re: Strings converted to numbers in Org table?
Date: Tue, 28 Feb 2017 08:43:49 +0100 [thread overview]
Message-ID: <m237eydakq.fsf@charm-ecran.irisa.fr> (raw)
In-Reply-To: <alpine.OSX.2.20.1702271005160.918@charles-berrys-macbook.local> (Charles C. Berry's message of "Mon, 27 Feb 2017 10:17:03 -0800")
[-- Attachment #1: Type: text/plain, Size: 1051 bytes --]
On 2017-02-27 10:17, "Charles C. Berry" <ccberry@ucsd.edu> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 454 bytes --]
prev parent reply other threads:[~2017-02-28 7:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-24 1:40 Strings converted to numbers in Org table? Vicente Vera
2017-02-27 13:49 ` Vicente Vera
2017-02-27 15:31 ` Vicente Vera
2017-02-27 17:33 ` Nicolas Goaziou
2017-02-27 19:20 ` Vicente Vera
2017-02-27 18:17 ` Charles C. Berry
2017-02-28 7:43 ` Alan Schmitt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m237eydakq.fsf@charm-ecran.irisa.fr \
--to=alan.schmitt@polytechnique.org \
--cc=ccberry@ucsd.edu \
--cc=emacs-orgmode@gnu.org \
--cc=vicentemvp@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.