emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Babel trouble: column names, arguments, and R dataframes
@ 2011-01-21 12:36 Christian Moe
  0 siblings, 0 replies; only message in thread
From: Christian Moe @ 2011-01-21 12:36 UTC (permalink / raw)
  To: Org Mode

Hi,

I'm having odd troubles with reading tables into R as dataframes with 
named vectors. Unfortunately I have difficulties pinning down a 
consistent problematic behavior. But one weird example follows below:

I have two tables, data1 and data2.

The first test reads data1 in as a dataframe named `values', and 
returns that dataframe, spitting out the identical table again. This 
is the behavior I expect.

The second test passes both tables as arguments. It's supposed to 
return the first table, just as the first test did -- and it returns 
the correct values, but the column names have been swapped with those 
in the second table! The third test, similarly, returns the second 
table, but with the colum names of the first table.

Any hints?

Yours,
Christian


#+tblname: data1
| Year | Value |
|------+-------|
| 2000 |    34 |
| 2001 |    55 |
| 2002 |    24 |

#+tblname: data2
| Yr   | Rate |
|------+------|
| 2000 | 1.10 |
| 2001 | 1.05 |
| 2002 | 1.12 |

#+source: try1(values=data1)
#+begin_src R :colnames yes
   values
#+end_src

#+results: try1
| Year | Value |
|------+-------|
| 2000 |    34 |
| 2001 |    55 |
| 2002 |    24 |


#+source: try2(values=data1, rates=data2)
#+begin_src R :colnames yes
   values
#+end_src

#+results: try2
|   Yr | Rate |
|------+------|
| 2000 |   34 |
| 2001 |   55 |
| 2002 |   24 |

#+source: try3(values=data1, rates=data2)
#+begin_src R :colnames yes
   rates
#+end_src

#+results: try3
| Year | Value |
|------+-------|
| 2000 |   1.1 |
| 2001 |  1.05 |
| 2002 |  1.12 |

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-01-21 12:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-21 12:36 Babel trouble: column names, arguments, and R dataframes Christian Moe

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).