emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: org tables and R
       [not found] <20081231084619.2353434807@mail2.panix.com>
@ 2008-12-31 19:54 ` Tom Breton (Tehom)
  2008-12-31 20:51   ` Dan Davison
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Breton (Tehom) @ 2008-12-31 19:54 UTC (permalink / raw)
  To: emacs-orgmode


Dan writes:
> There are more details below. The code is at
>
> http://www.stats.ox.ac.uk/~davison/software/org-table-R/org-table-R.el
>
> It would be great to get any feedback on this. My thought was that
> something like this has the potential to provide a unified plotting
> and table formula interface, which might be attractive to people who
> know and/or like and/or want to learn R. There's lots more that could
> be done with this, and there must be all sorts of bugs in it at this
> stage. But if there's any interest in it then it could be
> improved. Anyway, read on if you're interested in hearing more details
> about the options and actions available.
>
> Dan

Looks like you did a lot of work on this.

> - rownames:<integer>
>    Specifies that column n contains the names of the rows of the
>    table. These must be unique.

For column names, are you interpreting the existing table column name
syntax? (a special leftmost column with "!" in it (or "^" or "_"))
Or no column names?

> - replace:t
>    The original org-table is replaced by the text output (which will be
>    an org-table if the result is like a 1- or 2-dimensional array).

Does replace:nil do the opposite?

> - columns:<lisp-list>
>    This specifies the columns that the off-the-shelf action will
>    operate on (e.g. the columns you want to plot). The simplest case
>    is columns:j, where j is an integer. This could also be written
>    columns:(j). columns:((1)(2 3)) says that you want a graphic in
>    which columns 2 and 3 are plotted on the y-axis, and column 1 is
>    plotted on the x-axis. [...]

You might want to accept column names as well as column numbers.

Tom

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

* Re: Re: org tables and R
  2008-12-31 19:54 ` org tables and R Tom Breton (Tehom)
@ 2008-12-31 20:51   ` Dan Davison
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Davison @ 2008-12-31 20:51 UTC (permalink / raw)
  To: Tom Breton (Tehom); +Cc: emacs-orgmode

Hi Tom,

On Wed, Dec 31, 2008 at 02:54:29PM -0500, Tom Breton (Tehom) wrote:
> 
> Dan writes:
> [...]
> > - replace:t
> >    The original org-table is replaced by the text output (which will be
> >    an org-table if the result is like a 1- or 2-dimensional array).
> 
> Does replace:nil do the opposite?

Yes.

> 
> > - columns:<lisp-list>
> >    This specifies the columns that the off-the-shelf action will
> >    operate on (e.g. the columns you want to plot). The simplest case
> >    is columns:j, where j is an integer. This could also be written
> >    columns:(j). columns:((1)(2 3)) says that you want a graphic in
> >    which columns 2 and 3 are plotted on the y-axis, and column 1 is
> >    plotted on the x-axis. [...]
> 
> You might want to accept column names as well as column numbers.

Sorry, I should have mentioned. You can already do that, without changes to
the code. E.g.

| author          | date                            |
|-----------------+---------------------------------|
| Carsten Dominik | Thu, 12 Jun 2008 12:51:54 +0200 |
| Carsten Dominik | Wed, 11 Jun 2008 08:57:39 +0200 |
| Adam Spiers     | Wed, 11 Jun 2008 12:06:23 +0100 |
| Eddward DeVilla | Wed, 11 Jun 2008 12:15:11 -0500 |
| Eddward DeVilla | Wed, 11 Jun 2008 20:09:50 -0500 |
| Harri Kiiskinen | Wed, 04 Jun 2008 16:38:37 +0200 |
| Carsten Dominik | Thu, 12 Jun 2008 14:15:49 +0200 |
| Harri Kiiskinen | Thu, 12 Jun 2008 14:31:49 +0200 |
#+TBLR: columns:("author" "date") action:tabulate
#+TBLR:: x[,2] <- substr(x[,2], 1, 3)

turns into

|                 | Thu | Wed |
|-----------------+-----+-----|
| Adam Spiers     |   0 |   1 |
| Carsten Dominik |   2 |   1 |
| Eddward DeVilla |   0 |   2 |
| Harri Kiiskinen |   1 |   1 |


and of course you can do it in the R code:

| rowname | col1 | col2 |
|---------+------+------|
| row 1   |    1 |    2 |
| row 2   |    3 |    4 |
| total   |      |      |
#+TBLR:: x[3,] <- x["row 1",] + x["row 2",]
#+TBLR: rownames:1 replace:nil

turns into

| rownames(x) | col1 | col2 |
|-------------+------+------|
| row 1       |    1 |    2 |
| row 2       |    3 |    4 |
| total       |    4 |    6 |

Dan


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

-- 
http://www.stats.ox.ac.uk/~davison

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

end of thread, other threads:[~2008-12-31 20:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20081231084619.2353434807@mail2.panix.com>
2008-12-31 19:54 ` org tables and R Tom Breton (Tehom)
2008-12-31 20:51   ` Dan Davison

Code repositories for project(s) associated with this 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).