From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: Strings converted to numbers in Org table? Date: Tue, 28 Feb 2017 08:43:49 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cicRw-0001Vn-Np for emacs-orgmode@gnu.org; Tue, 28 Feb 2017 02:43:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cicRt-0002ef-Lv for emacs-orgmode@gnu.org; Tue, 28 Feb 2017 02:43:56 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:38021) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cicRt-0002cu-Aa for emacs-orgmode@gnu.org; Tue, 28 Feb 2017 02:43:53 -0500 In-Reply-To: (Charles C. Berry's message of "Mon, 27 Feb 2017 10:17:03 -0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "Charles C. Berry" Cc: emacs-orgmode , Vicente Vera --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2017-02-27 10:17, "Charles C. Berry" writes: > IMHO, it is often best to handle formatting of output in the language of= =20 > the src block. There are some tools for doing this in R: the `ascii'=20 > 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=3Dtps (mapcar (lambda (row) (mapcar (lambda (cell) (if (numberp cell) (number-to-string cell) cell)) row)) data) #+END_SRC #+BEGIN_SRC ocaml :var data=3Dconvert-table :results output raw (* ocaml code *) #+END_SRC Best, Alan =2D-=20 OpenPGP Key ID : 040D0A3B4ED2E5C7 Monthly Athmospheric CO=E2=82=82, Mauna Loa Obs. 2017-01: 406.13, 2016-01: = 402.52 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJYtSo1AAoJEAQNCjtO0uXHM2sH/1KPnbqdoI87NMAqE3ZJZ8wk LdLTtZlu+PrHQ1WywBF8b31TOWJLJHx435KDtUVha+zqk77OaoVLR60tw7Rukdsc bXGLiUxR3nVKXdAHrvlBYUklPSsh1Evj78mymP7l2hwhloNg6IRVo78xyYGkqKcd 1tGU1hLxyNZV9B5WeRwFfalH1oqToWyYISrlBLe5yLywNyr4w+3v/HblJJS6ZOWz uaIbNGV8nBJXa3FJ/GJPnAQjOsvX5Dye3KZt4hwJee1YLfy6GcrDkiQwZZkkcNPy goRBn74+4InO7wNOrisTJj4iPfIk2h5eMG6hdwFNmUJb2ze9hwi11GC2Oe/hrQo= =lYo4 -----END PGP SIGNATURE----- --=-=-=--