emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* creating a list from an R source block
@ 2012-09-04 16:42 Greg Tucker-Kellogg
  2012-09-04 16:55 ` John Hendy
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Tucker-Kellogg @ 2012-09-04 16:42 UTC (permalink / raw)
  To: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 559 bytes --]

Creating a list in Org from a Ruby Array is trivial

#+BEGIN_SRC ruby :exports results :results value list
["x" , "y", "z" ] 
#+END_SRC

#+RESULTS:
- x
- y
- z

But trying the same thing from R gives a surprising (to me) result

#+BEGIN_SRC R :exports results :results value list
c("x","y","z")
#+END_SRC

#+RESULTS: 
- ("x")
- ("y")
- ("z")

removing the list header creates a table, but there seems to be no straightforward way in R to create a list of elements that is treated by Org as a list.  Am I missing something?

Greg


	

[-- Attachment #2: Type: text/html, Size: 1440 bytes --]

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

* Re: creating a list from an R source block
  2012-09-04 16:42 creating a list from an R source block Greg Tucker-Kellogg
@ 2012-09-04 16:55 ` John Hendy
  2012-09-04 22:43   ` Greg Tucker-Kellogg
  0 siblings, 1 reply; 3+ messages in thread
From: John Hendy @ 2012-09-04 16:55 UTC (permalink / raw)
  To: Greg Tucker-Kellogg; +Cc: Org Mode List

On Tue, Sep 4, 2012 at 11:42 AM, Greg Tucker-Kellogg
<gtuckerkellogg@gmail.com> wrote:
> Creating a list in Org from a Ruby Array is trivial
>
> #+BEGIN_SRC ruby :exports results :results value list
> ["x" , "y", "z" ]
> #+END_SRC
>
> #+RESULTS:
> - x
> - y
> - z
>
>
> But trying the same thing from R gives a surprising (to me) result
>
> #+BEGIN_SRC R :exports results :results value list
> c("x","y","z")
> #+END_SRC
>
> #+RESULTS:
> - ("x")
> - ("y")
> - ("z")
>

Clunky, perhaps, but this works:

#+BEGIN_SRC R :exports results :results output org
a <- c("x","y","z")
cat(paste("-", a), sep="\n")

#+END_SRC

#+RESULTS:
#+BEGIN_ORG
- x
- y
- z
#+END_ORG

Best regards,
John


>
> removing the list header creates a table, but there seems to be no
> straightforward way in R to create a list of elements that is treated by Org
> as a list.  Am I missing something?
>
> Greg
>
>

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

* Re: creating a list from an R source block
  2012-09-04 16:55 ` John Hendy
@ 2012-09-04 22:43   ` Greg Tucker-Kellogg
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Tucker-Kellogg @ 2012-09-04 22:43 UTC (permalink / raw)
  To: John Hendy; +Cc: Org Mode List

Thanks, that works.  But does this count as a bug in ob-R?

Greg


On Sep 5, 2012, at 12:55 AM, John Hendy wrote:

> On Tue, Sep 4, 2012 at 11:42 AM, Greg Tucker-Kellogg
> <gtuckerkellogg@gmail.com> wrote:
>> Creating a list in Org from a Ruby Array is trivial
>> 
>> #+BEGIN_SRC ruby :exports results :results value list
>> ["x" , "y", "z" ]
>> #+END_SRC
>> 
>> #+RESULTS:
>> - x
>> - y
>> - z
>> 
>> 
>> But trying the same thing from R gives a surprising (to me) result
>> 
>> #+BEGIN_SRC R :exports results :results value list
>> c("x","y","z")
>> #+END_SRC
>> 
>> #+RESULTS:
>> - ("x")
>> - ("y")
>> - ("z")
>> 
> 
> Clunky, perhaps, but this works:
> 
> #+BEGIN_SRC R :exports results :results output org
> a <- c("x","y","z")
> cat(paste("-", a), sep="\n")
> 
> #+END_SRC
> 
> #+RESULTS:
> #+BEGIN_ORG
> - x
> - y
> - z
> #+END_ORG
> 
> Best regards,
> John
> 
> 
>> 
>> removing the list header creates a table, but there seems to be no
>> straightforward way in R to create a list of elements that is treated by Org
>> as a list.  Am I missing something?
>> 
>> Greg
>> 
>> 

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

end of thread, other threads:[~2012-09-04 22:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-04 16:42 creating a list from an R source block Greg Tucker-Kellogg
2012-09-04 16:55 ` John Hendy
2012-09-04 22:43   ` Greg Tucker-Kellogg

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).