Jarmo Hurri <jarmo.hu...@syk.fi> writes:

> Greetings again.
>
> I need to represent a contingency table generated by R in an org file. R
> output shows the labes of the vertical and the horizontal axes, but
> these are pruned from the output in org-mode. Is there a nice way to
> reintroduce the axes labels?
>
> # ----------------------------------------------------------------------
> * interesting data
>   #+BEGIN_SRC R :exports results :rownames yes :colnames yes
>     org.files <- c (1, 0, 2, 2, 2, 2, 1)
>     happiness <- c (1, 0, 2, 2, 2, 1, 2)
>     data <- data.frame (org.files, happiness)
>     table (data)
>   #+END_SRC
>
>   #+RESULTS:
>   |   | 0 | 1 | 2 |
>   |---+---+---+---|
>   | 0 | 1 | 0 | 0 |
>   | 1 | 0 | 1 | 1 |
>   | 2 | 0 | 1 | 3 |
> # ----------------------------------------------------------------------
>
> All the best,
>
> Jarmo
>
>
>

library(ascii)
...
print(ascii(table(data)), type="org")

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

Reply via email to