From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id Gg2CJ+YwIWHrXwEAgWs5BA (envelope-from ) for ; Sat, 21 Aug 2021 18:59:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id wKCLIuYwIWFjZwAAB5/wlQ (envelope-from ) for ; Sat, 21 Aug 2021 16:59:18 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 04B9E5EF8 for ; Sat, 21 Aug 2021 18:59:18 +0200 (CEST) Received: from localhost ([::1]:43834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHUKy-0006nZ-Vy for larch@yhetil.org; Sat, 21 Aug 2021 12:59:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHUKc-0006nC-Qj for emacs-orgmode@gnu.org; Sat, 21 Aug 2021 12:58:54 -0400 Received: from mail-vs1-xe35.google.com ([2607:f8b0:4864:20::e35]:38439) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHUKb-0000WM-83 for emacs-orgmode@gnu.org; Sat, 21 Aug 2021 12:58:54 -0400 Received: by mail-vs1-xe35.google.com with SMTP id t4so5383149vsm.5 for ; Sat, 21 Aug 2021 09:58:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UKZvX4DPD6z+NUb1nR6PG3d+gefyJSMYu5k3mV33HKk=; b=YNckN6nYQWVX+ML/ZWY9bz+zMEvDcpU1ooqApbBlD+ePbGs2xIuJkcp48KynqWIBQe aZG0pAYZS5ZZx6cKbOP/oCxY3S2dt/a5FTkmgHTRS441V1wG7cRPHe4XICcjtNWfvp46 cdB7AK8Bl39vIzX9AH6y8Rpa1sktw1Wmg5YUrurum3VbvW9sgCIu2/fmlcVt2xhkff73 U6UVoCsKVU/tsn4eTYbkgKdvgD7Mt5/8xfF3nYwNiLbmgqZzhxVjPeye9o5HtsD37Zbe V3jiawYm9bGCIxJMn1P/Bgl+e6XxfLvApDPwGVRVb3lGIjlZQaBVfoJv4veRtxQ82yFA J7hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UKZvX4DPD6z+NUb1nR6PG3d+gefyJSMYu5k3mV33HKk=; b=q1JG+y32nZcKXfDpVqI1e/jKg28ucq+qZXf0JuLJtiGaugV9yWO45pvCS7q9ipwtfJ 8AdT+iG9U0JNC52j49M4OAYqEe2evaJxfLIj6XLt/+30EHbj3t+5oVIHPJoPMJp0mvZY aIueMiepBt3eKD6S42+C30D5XM/lGgfBVA1J/gDoKeZSViMv0DHU0uhHvgqqGIopVkfm 1XbpI3iOL74UKauuDbwihKNdqb/kp4Zi0Dhfzq38gcBL5R1QmdtWOp8KnJLT8pEP2Pxm bYSwQ0fBFJyvSCjiZK7j7siNgVAmFNYVf9dgoki3htcGM6PlZf112+mNlaA5BFkX6L8C tj0g== X-Gm-Message-State: AOAM5300tUxsjNc0BEs8zVrDpdSUhUVL8oFcJCtMCdiL5bV4i9SuNCiO YEu+LyS9BKH6hwvjVC/CW8nH9ilFCY3TCVljdyk= X-Google-Smtp-Source: ABdhPJzXu/K0+8c9UZJkFUvhQ12pAbIGP+7w90TBF2rWdCbnDYlz8lfRy8O6oBjNQ+3OheCH8BGIHk0M2cRZqv/PYyE= X-Received: by 2002:a67:ed0d:: with SMTP id l13mr20127143vsp.48.1629565131590; Sat, 21 Aug 2021 09:58:51 -0700 (PDT) MIME-Version: 1.0 References: <09213D27-4679-4C44-B512-8E257CFECA4D@health.ucsd.edu> In-Reply-To: <09213D27-4679-4C44-B512-8E257CFECA4D@health.ucsd.edu> From: John Hendy Date: Sat, 21 Aug 2021 11:58:40 -0500 Message-ID: Subject: Re: Number format for table results outut from R data.frame/tibble To: "Berry, Charles" Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::e35; envelope-from=jw.hendy@gmail.com; helo=mail-vs1-xe35.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1629565158; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=UKZvX4DPD6z+NUb1nR6PG3d+gefyJSMYu5k3mV33HKk=; b=gfhTSCZk9qaTTf+cLFrSSKXJuFGgPeVH+fjlPPTusD83wkHnEc2zJneNJ9hbk7lj7mzfKB 4x3yapS8VwTglNM/wvsKRAXg/S1vO7VR5prA5UYPcG35jo5k75DRxxvoaLUFDBVf0xwWt0 BKvjZWqwxDeY6oZ3VmEZNwA/fT/gBaqbgjqMg5mZUIeW3F2XD+ioSlERLH3g4qzeVoia4Y kYDg1X/PrEzZsr/BvsrkjyKePXZW27YA8PlRBAVTo1RGgxwjF5c8ti5ujYZ5X+sCBonPRD PCm2gqbkuR+G4NoJtxPCvUfv9bbvtjAWSFcb1PGZrJz9V49NYDja6lXBhtQo5w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1629565158; a=rsa-sha256; cv=none; b=QY4L74783bKelPuEUN+Ss/rWv9HnIS1vv6Zupcr++o8D2/Da+MkcARfBokb25m/CFnd78a Cf8fBvZ9OWvsF9JPMcxMPp0RnryDC1fSEbNWXeIH0vsTp4se7iNZInJLPDMbI04bZsBEiB sfj59vX5lrz0QpW95yHyxg5VVDO5QUtRAy/h1WyajQxqTV1cHRSyjltejyTVmSQHqWJjLP dTG28aIkZmdehyuh9FxAgzy8zykyRZD/fknQdg1UQZZ68TfwlZaZ/4BU5Vqsf2BybhQKdC a5hFY1buZ2bnrfRN4evfO4LcHS5lejXqN0i6+Lcxgx+Jy8B+r7ttD8YvkUyxKg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=YNckN6nY; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.12 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=YNckN6nY; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 04B9E5EF8 X-Spam-Score: -3.12 X-Migadu-Scanner: scn0.migadu.com X-TUID: /yfmLwm5PGpY On Fri, Aug 6, 2021 at 2:30 PM Berry, Charles wrote: > > John, > > > On Aug 6, 2021, at 8:38 AM, John Hendy wrote: > > > > Greetings, > > > > I'm wondering how to align the results from the R buffer (which I > > like) vs. the results printed by Org-mode for table results. Here's a > > toy example: > > > > `tbl_df' objects come with their own print/show method. And it does things like add color and text formats. This is nice in a terminal, but not when you want to display them in org. > > Turning off the color might be enough to give you a usable result: > > #+begin_src R :session foo :results output drawer > library(tibble) > options( cli.num_colors=1 ) > tmp <- tibble(x=1:5, y=x/pi) > tmp > #+end_src > > #+RESULTS: > :results: > > # A tibble: 5 x 2 > x y > > 1 1 0.3 > 2 2 0.6 > 3 3 1. > 4 4 1. > 5 5 2. > :end: > Interesting, and thanks for taking a look. I don't think I specified sufficiently that I'm actually aiming for latex/pdf output and therefore want the org table. I can just add my own header row and get booktabs formatting free upon export. If I keep with :results output, the color options trick does remove a bunch of garbage from the output... but :results value still yields: #+RESULTS: | 1 | 0.318309886183791 | | 2 | 0.636619772367581 | | 3 | 0.954929658551372 | | 4 | 1.27323954473516 | | 5 | 1.59154943091895 | I was hoping there was a way to either (a) have org post-format or (b) take the results as printed. I'm not sure on the exact mechanism used which creates the mismatched output in the session vs. the table. I get that behind the scenes I still have long, irrational numbers here... it's just that if org can print them with x decimal places, is there some way to get Org to intercept *those* values? John > > If this is not close to what you need, I suggest writing your own formatting function. If you have limited emacs-lisp skill, I suggest doing this in R. > > HTH, > > Chuck