all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [babel] html export of R data frame
@ 2010-07-20  2:27 Vikas Rawal
  2010-07-20  2:39 ` Thomas S. Dye
  0 siblings, 1 reply; 3+ messages in thread
From: Vikas Rawal @ 2010-07-20  2:27 UTC (permalink / raw)
  To: emacs-orgmode

I have an R script which outputs a small table in the form of a
dataframe. In org-babel, this dataframe is not displayed as an org
table but simply as text laid out as it would be in an R session. 

When I export the output to html, I do not get an html table but only
text. How do I make org-babel show a table instead of plain text?

For example, take a simple code block like:

#+BEGIN_SRC R :results output :exports both :session y
  x<-c(1:5)
  y<-x^2
  data.frame(x,y)
#+END_SRC


Vikas






 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [babel] html export of R data frame
  2010-07-20  2:27 [babel] html export of R data frame Vikas Rawal
@ 2010-07-20  2:39 ` Thomas S. Dye
       [not found]   ` <20100720031301.GA6691@panahar>
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas S. Dye @ 2010-07-20  2:39 UTC (permalink / raw)
  To: Vikas Rawal; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 914 bytes --]


On Jul 19, 2010, at 4:27 PM, Vikas Rawal wrote:

> I have an R script which outputs a small table in the form of a
> dataframe. In org-babel, this dataframe is not displayed as an org
> table but simply as text laid out as it would be in an R session.
>
> When I export the output to html, I do not get an html table but only
> text. How do I make org-babel show a table instead of plain text?
>
> For example, take a simple code block like:
>
> #+BEGIN_SRC R :results output :exports both :session y
>  x<-c(1:5)
>  y<-x^2
>  data.frame(x,y)
> #+END_SRC
>
>
> Vikas
>
>

Aloha Vikas,

Is this what you want?

#+BEGIN_SRC R :results value :exports both
  x<-c(1:5)
  y<-x^2
  data.frame(x,y)
#+END_SRC

#+results:
| 1 |  1 |
| 2 |  4 |
| 3 |  9 |
| 4 | 16 |
| 5 | 25 |

hth,
Tom



Thomas S. Dye, Ph.D.
T. S. Dye & Colleagues, Archaeologists, Inc.
Phone: (808) 529-0866 Fax: (808) 529-0884
http://www.tsdye.com



[-- Attachment #1.2: Type: text/html, Size: 3686 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [babel] html export of R data frame
       [not found]   ` <20100720031301.GA6691@panahar>
@ 2010-07-20  8:08     ` Thomas S. Dye
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas S. Dye @ 2010-07-20  8:08 UTC (permalink / raw)
  To: Vikas Rawal; +Cc: Emacs-orgmode mailing list


On Jul 19, 2010, at 5:13 PM, Vikas Rawal wrote:

>>
>> Is this what you want?
>>
>> #+BEGIN_SRC R :results value :exports both
>
> Indeed. Except that, in the functional mode, org-babel shows me output
> of only the last command, and not the intermediate commands.
>
> I am not too happy with that. When I do my data analysis, sometimes a
> program gives out several outputs. Let me see how would I handle that
> in the functional mode.
>
> Thanks anyway,
>
> Vikas
>


Aloha Vikas,

Here is one way to see intermediate values in functional mode.

#+srcname: vikas-x
#+begin_src R
  x<-c(1:5)
#+end_src

#+results: vikas-x
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |

#+srcname: vikas-y
#+begin_src R :var x=vikas-x
  y<-x^2
#+end_src

#+results: vikas-y
|  1 |
|  4 |
|  9 |
| 16 |
| 25 |

#+BEGIN_SRC R :results value :var x= vikas-x :var y= vikas-y :exports  
both
  data.frame(x,y)
#+END_SRC

#+results:
| 1 |  1 |
| 2 |  4 |
| 3 |  9 |
| 4 | 16 |
| 5 | 25 |

All the best,
Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-20  8:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-20  2:27 [babel] html export of R data frame Vikas Rawal
2010-07-20  2:39 ` Thomas S. Dye
     [not found]   ` <20100720031301.GA6691@panahar>
2010-07-20  8:08     ` Thomas S. Dye

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.