emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Number format for table results outut from R data.frame/tibble


From: Berry, Charles
Subject: Re: Number format for table results outut from R data.frame/tibble
Date: Fri, 6 Aug 2021 19:30:01 +0000

John,

> On Aug 6, 2021, at 8:38 AM, John Hendy <jw.hendy@gmail.com> 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
  <int> <dbl>
1     1   0.3
2     2   0.6
3     3   1. 
4     4   1. 
5     5   2.
:end:


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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]