From: Christian Moe <mail@christianmoe.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: Babel trouble: column names, arguments, and R dataframes
Date: Fri, 21 Jan 2011 13:36:47 +0100 [thread overview]
Message-ID: <4D397DDF.9070106@christianmoe.com> (raw)
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 other threads:[~2011-01-21 12:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D397DDF.9070106@christianmoe.com \
--to=mail@christianmoe.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.