Re: [O] org-odt: cannot find factory styles

2012-03-05 Thread Matthew Landis



On 3/2/2012 3:38 PM, Jambunathan K wrote:

If the Org is meant for a global distribution (as opposed to personal
installation), the distributor has to specifically ask the users to copy
the styles file to<>/etc/org.

C-h v data-directory

In your case, the data-directory is c:/emacs-23.4/etc/org/.

snipped

Style files from the git repo is here:
http://orgmode.org/w/?p=org-mode.git;a=tree;f=etc/styles;hb=HEAD

Schema files form the git repo is here:
http://orgmode.org/w/?p=org-mode.git;a=tree;f=contrib/odt/etc/schema;hb=HEAD

Remember to download the raw files if you are downloading from git repo.


dear K,
Thanks very much for your response.  Based on what you said above, I was 
able to get it working.  I downloaded the Style and Schema files from 
the git repo, and put them in to the directories that emacs was 
searching, namely:


Debug (org-odt): Using schema files under 
c:/emacs-23.4/site-lisp/contrib/odt/etc/schema/

Debug (org-odt): Using styles under c:/emacs-23.4/site-lisp/etc/styles/

In both cases, I had to create the directories.  to put them in.  I 
figured it was easier (for now) to put the files where this installation 
expected them, rather than fix the installation using ELPA etc.  When I 
update, I'm sure I will use the other approaches you mentioned.


Before I could get ODT success, I also had to install zip and unzip for 
my Windows machine, which I found at 
http://gnuwin32.sourceforge.net/packages.html


Now it works great.

thanks!

M

--
~~~~~~
Matthew Landis, Ph.D.
Research Scientist
ISciences, LLC
61 Main St. Suite 200
Burlington VT 05401
802.864.2999
www.isciences.com
~~




Re: [O] Selectively export RESULTS

2012-03-02 Thread Matthew Landis



On 3/2/2012 2:33 PM, Eric Schulte wrote:


The above line should be #+PROPERTY: singular.  That explains why
file-wide settings aren't working for you.
THANK YOU.  That makes it work, especially once I realized that the 
Property has to be set when the buffer is loaded.  Now I have

#+PROPERTY: eval no-export

I would suggest either fixing the properties issue above, which will 
allow you to set eval to "no" before export when you are content with 
your current results, 
This is exactly what I did, and it does exactly what I want.  org-babel 
totally rocks.



--
~~~~~~
Matthew Landis, Ph.D.
Research Scientist
ISciences, LLC
61 Main St. Suite 200
Burlington VT 05401
802.864.2999
www.isciences.com
~~




[O] org-odt: cannot find factory styles

2012-03-02 Thread Matthew Landis

Hello all,

I've been googling this problem and searching the archives, but I can't 
seem to find a solution.  When I try to export to ODT, I get


Error (org-odt): Cannot find factory styles files. Aborting.

Looking in my *Messages* buffer, I see at startup:

Debug (org-odt): Searching for OpenDocument schema files...
Debug (org-odt): Trying 
c:/c/Emacs-modified/tmpdir/emacs-23.4/etc/org/schema/...

Debug (org-odt): Trying c:/emacs-23.4/site-lisp/contrib/odt/etc/schema/...
Debug (org-odt): No OpenDocument schema files installed
Debug (org-odt): Searching for OpenDocument styles files...
Debug (org-odt): Trying 
c:/c/Emacs-modified/tmpdir/emacs-23.4/etc/org/styles/...

Debug (org-odt): Trying c:/emacs-23.4/site-lisp/etc/styles/...
Debug (org-odt): Trying c:/emacs-23.4/site-lisp/org/etc/styles/...
Debug (org-odt): Trying c:/emacs-23.4/etc/org/...
Problems while trying to load feature `org-odt'

So you can see that i am using Windows (Win 7 64 bit).  In fact, I am 
using Vincent Goulet's Windows installer (modified-2, FWIW), and I 
directed it to install into C:/emacs-23.4 instead of the default 
C:/Program Files (x86) directory.


Looking in the site-lisp directories for the folders org-odt is 
searching, I don't see contrib, org, or etc directories.


But I do see C:/emacs-23.4/etc/org/styles, which has OrgOdtStyles.xml, 
and C:/emacs-23.4/etc/schema, which doesn't obviously have any files to 
do with ODT.


Is there a workaround or alternative installation to fix it?  It would 
be really cool to export to ODT!


M


--
~~~~~~
Matthew Landis, Ph.D.
Research Scientist
ISciences, LLC
61 Main St. Suite 200
Burlington VT 05401
802.864.2999
www.isciences.com
~~




Re: [O] Selectively export RESULTS

2012-03-02 Thread Matthew Landis



On 3/2/2012 12:59 PM, Christophe Pouzat wrote:


Matthew,

I think that you're wrongly expecting babel's cache header argument to
behave like the argument of the same name in Sweave code chunks. Babel
will cache, in your case, the value of your code block evaluation and
there is none in your first code block, therefore nothing gets cached by
babel, try that instead:

#+name: my-random-vector
#+begin_src R :session :cache yes
rnorm(100)
#+end_src

#+headers: :var x=my-random-vector
#+headers: :results graphics :exports results :file hist.png
#+begin_src R :session  :cache yes
hist(x)
#+end_src

Does it work better? In that case you don't even need a session.

Christophe
Christophe - thanks for the suggestion.  I haven't messed around much 
with variables passed between code blocks.  When I try this, R tells me 
that 'x' must be numeric.  When I query x in the R buffer, x is a 
data.frame.  So the second code block reads x in as a data.frame instead 
of a numeric vector.


For most purposes this would be OK (since a data.frame is the most usual 
outcome), but I'm reluctant to use this approach -- I'd like all of the 
variable passing to be in the R session.  Intuitively this seems 
simpler, less error prone, and more conducive to tangling later.  (Of 
course, I could be totally wrong - since I haven't really tried that 
approach).


M

--
~~
Matthew Landis, Ph.D.
Research Scientist
ISciences, LLC
61 Main St. Suite 200
Burlington VT 05401
802.864.2999
www.isciences.com
~~




Re: [O] Selectively export RESULTS

2012-03-02 Thread Matthew Landis
Eric Schulte  gmx.com> writes:

> 
> Matthew Landis  isciences.com> writes:
> 
> Have you tried this?  The cache header argument has special handling of
> code blocks with sessions to handle such cases.

Fair enough!  I hadn't tried it.  But I did just try this example:

-
#+TITLE: Super simple example using cache header arguments
#+PROPERTIES: eval no

Here is a really simple example.

#+begin_src R :session :results silent :exports code :cache yes
x <- rnorm(100)
cat('ran this code block')
#+end_src

here is code block two.

#+begin_src R :session :results graphics :exports both :file hist.png :cache yes
hist(x, main = 'A new title' )
#+end_src

#+results[1987d49b46ffd8b7263dc04e7c7b5d25f90342aa]:
[[file:hist.png]]
-

RESULTS:
On 1st export to html, both code blocks are run, and #+results block is *not* 
created.  

On 2nd export, both code blocks are run again, counter to my desires.

IF I run the code blocks interactively first using C-c C-c, the #+results block 
is created for the code block 2.  After that, subsequent exports run code block 
1 but not code block 2.  Again, this is counter to my desires because I want 
code block 1 to be ignored as well.  I understand why code block 1 is rerun, 
because I have :results silent, but I'd rather not have to change that.  
Generally, code block 1 is producing large R data.frames which don't need to be 
viewed anywhere.

> Are you requesting a new option to :cache, such that even if the code
> block has changes the old results are used anyway?

Sort of.  I think I'm asking for a file wide option to decide whether to run 
any 
code blocks, or just do the export based on whatever is currently existing in 
the #+results blocks.

As in this example, I tried #+PROPERTIES: eval no but it is ignored.  It would 
be great if I could set an eval argument at the top of the file to be either 
'no' (don't run any code blocks) 'yes' (run all code blocks) or 'block' respect 
block level eval settings 

Maybe such functionality exists in some other way - I claim only beginners 
knowledge of org-babel.







Re: [O] org-export-blocks-preprocess: Marker does not point anywhere

2012-03-02 Thread Matthew Landis
Nick Dokos  hp.com> writes:

> 
> Matthew Landis  isciences.com> wrote:

> 
> I can't reproduce it either with latest (more or less) or with 7.8.03.
> The html export succeeds and the code is exported, pdf export (with
> minted) succeeds except that the code block is not processed, because
> there is no minted lexer for R (at least in my setup). But I get no
> error.
> 
> Nick

Well, thanks for trying.  In my current work flow, I tend to have an R session 
running before I try to export, so I'm not troubled by this anymore.  I guess 
I'll just wait until it's a problem.

M







Re: [O] Selectively export RESULTS

2012-03-02 Thread Matthew Landis
  tajo.ucsd.edu> writes:

> 
> Eric Schulte  gmx.com> writes:
> 
> >>> Does this do what you want?

> >
> > Have you looked at the :cache header argument [1], from my understanding
> > of your use case it should be exactly what you are after.
> >
> 
> Its a step in the right direction.
> 
> It seems I have to set :cache yes on every block I use before I invoke
> it. My attempt to use a buffer-wide PROPERTY setting for cache did not
> pan out. 
> 

I'd like to put in a vote for the kind of functionality that cberry is 
describing.  I have a very similar situation - a large org file that uses R to 
do a lot of time consuming data manipulation and model fitting, resulting in 
statistical tables and graphs.  I run a lot of the code blocks as I'm writing 
it, resulting in :results in the org file.  

In the end, I'd like to export the org file to html or ODT, but I'd like to be 
able to choose buffer-wide whether to rerun all of the code blocks or just use 
the results that are already in the buffer.  I tried setting #+PROPERTY: eval 
no 
at the top of the buffer in the hopes that on export, it would ignore all my 
code blocks and just incorporate the :results, but this was ignored and my code 
blocks were rerun.

The cache argument only partially deals with the problem, as this example 
illustrates:

#+begin_src R :session :cache yes
x <- rnorm(100)
#+end_src

#+begin_src R :session :results graphics :exports results :file hist.png :cache 
yes
hist(x)
#+end_src

Now after the first export, I change code block 2, but not code block 1.  If I 
understand how cache works correctly, code block 2 will be rerun, but it will 
fail because code block 1 is not rerun, so x doesn't exist in the R session.  

For this reason, I'd prefer to be able to decide whether to re-run on a file-
wide basis.

Many thanks to all of you who have created such an amazing system.  

M





Re: [O] org-export-blocks-preprocess: Marker does not point anywhere

2012-03-01 Thread Matthew Landis

On 3/1/2012 12:47 AM, Nick Dokos wrote:

Matthew Landis  wrote:


Hello orgmode fans,

Another issue with org and R giving me headaches tonight.

In the example below, using the :session header argument seems to cause 
problems with export to html.  On export, the *R* buffer is
opened up, but no file is created.  in the *Messages* buffer, I see

org-export-blocks-preprocess: Marker does not point anywhere

however, if I try to export again, with the *R* buffer already open,
then things work fine.  This is an OK work around I guess, but I
thought someone ought to know about it.

Session info:
Windows 7, 64 bit.
Emacs version: GNU Emacs 23.4.1 (i386-mingw-nt6.1.7601) of 2012-02-04
on MARVIN
Org mode version 7.8.03
ESS version 5.14
R version 2.14.1

Example now included! (Thanks Nick, for pointing that out...)

#+begin_src R :session :exports code :results silent

  x <- runif(n = 100, min = 0, max = 20)
  y <- 4*x^2 + 0.3*x + 3 + rnorm(100, sd = 200)

#+end_src





[O] org-export-blocks-preprocess: Marker does not point anywhere

2012-02-29 Thread Matthew Landis

Hello orgmode fans,

Another issue with org and R giving me headaches tonight.

In the example below, using the :session header argument seems to cause 
problems with export to html.  On export, the *R* buffer is opened up, 
but no file is created.  in the *Messages* buffer, I see


org-export-blocks-preprocess: Marker does not point anywhere

however, if I try to export again, with the *R* buffer already open, 
then things work fine.  This is an OK work around I guess, but I thought 
someone ought to know about it.


Session info:
Windows 7, 64 bit.
Emacs version: GNU Emacs 23.4.1 (i386-mingw-nt6.1.7601) of 2012-02-04 on 
MARVIN

Org mode version 7.8.03
ESS version 5.14
R version 2.14.1

M

--
~~
Matthew Landis, Ph.D.
Research Scientist
ISciences, LLC
61 Main St. Suite 200
Burlington VT 05401
802.864.2999
www.isciences.com
~~




Re: [O] problems with R graphics

2012-02-29 Thread Matthew Landis
Matthew Landis  isciences.com> writes:

> 
> Hello all,
...

> Unfortunately, I can't seem to get graphics 
> to insert themselves properly on export.  



> org example
> 
...
> * A stand-alone code block
> 
> First, create some data, perform a regression, and plot it.  This
> works great.
> #+begin_src R :results graphics :file regress.png :exports both
> 
>   x <- runif(n = 100, min = 0, max = 20)
>   y <- 5*x^2 + 0.3*x + 3 + rnorm(100, sd = 200)
> 
>   f <- lm(y ~ x)
> 
>   plot(x, y, bty = 'n')
>   abline(f, lty = 'dashed')
> 
> #+end_src
> Success.
...

> #+begin_src R :session :results graphics :file regress_session.png :exports 
both
> 
>  plot(x, y, bty = 'n')
>  abline(f, lty = 'dashed')
> 
> #+end_src
> This code block doesn't work. No error, but no file is created.

...

I actually figured this one out just now.  If creating a file in a 'stand 
alone' 
code block, the default directory is the directory that the org file itself is 
in.  However, in a 'session' code block, the default directory is something 
else 
(R's default?).  If I specify the full path to the file in the 'session' code 
block, things work better.

Sorry for the noise!

M







[O] problems with R graphics

2012-02-29 Thread Matthew Landis
Hello all,

I believe this is my first post on this list, and I'm very new to org-babel, so 
forgive me if I am posting nonsense.  However, I'm really enthused about the 
possibilities org-babel presents.  Unfortunately, I can't seem to get graphics 
to insert themselves properly on export.  I've included an example that 
reproduces my problem below.  For what it's worth, I am using Windows 7 with a 
freshly downloaded issue of Vincent Goulet's package.  Session info:

Emacs version: GNU Emacs 23.4.1 (i386-mingw-nt6.1.7601) of 2012-02-04 on MARVIN
Org mode version 7.8.03
ESS version 5.14
R version 2.14.1

Many thanks for any thoughts or requests for more info.

Matt

org example


#+TITLE: An attempt to make org-mode work with R

In this example, I want to fit a regression and plot it.  I'm
following the examples at the [[http://orgmode.org/worg/org-
contrib/babel/languages/ob-doc-R.html][org manual]] and Erik Iverson's 
[[https://github.com/erikriverson/org-mode-R-tutorial][tutorial]].

* A stand-alone code block

First, create some data, perform a regression, and plot it.  This
works great.
#+begin_src R :results graphics :file regress.png :exports both

  x <- runif(n = 100, min = 0, max = 20)
  y <- 5*x^2 + 0.3*x + 3 + rnorm(100, sd = 200)

  f <- lm(y ~ x)

  plot(x, y, bty = 'n')
  abline(f, lty = 'dashed')

#+end_src
Success.

* In code blocks using ":session"
Now do the same thing, but across an unnamed session

#+begin_src R :session :exports code :results silent

  x <- runif(n = 100, min = 0, max = 20)
  y <- 5*x^2 + 0.3*x + 3 + rnorm(100, sd = 200)

#+end_src

Now, I would like to display the results of the regression as R output.

#+begin_src R :session :results output :exports both
  f <- lm(y ~ x)
  summary(f)
#+end_src
Again, success!  This is really going to come in handy.

#+begin_src R :session :results graphics :file regress_session.png :exports both

 plot(x, y, bty = 'n')
 abline(f, lty = 'dashed')

#+end_src
This code block doesn't work. No error, but no file is created.
Also, if I press C-c C-c in the code block, in the org file I get

#+begin_example
#+results:
[[file:regress_session.png]]
#+end_example

But no file is actually created.  What could be going wrong?