emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Babel trouble: column names, arguments, and R dataframes


From: Christian Moe
Subject: [Orgmode] Babel trouble: column names, arguments, and R dataframes
Date: Fri, 21 Jan 2011 13:36:47 +0100
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7

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 |




reply via email to

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