emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Question related to org-babel-expand-src-block
@ 2012-02-02 17:52 Christophe Pouzat
  2012-02-03 18:49 ` Eric Schulte
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe Pouzat @ 2012-02-02 17:52 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

Using the last org-mode version from the git repository (7.8.03) I've found a
mismatch between the key-chord required to call function
=org-babel-expand-src-block= (=C-c C-v v=) and the ones given in the
info file: =C-c C-v p= or =C-c C-v C-p=. The same goes for the
[[http://orgmode.org/worg/org-contrib/babel/intro.html][Babel:
Introduction]] where the given key-chord is =C-c M-b p=. 

In the same line, I have a question concerning the inclusion of the
/expanded/ source block in the generated output. Let's assume that I
define in my =.org= file a variable containing a file name like:

#+name: my-file-name
: dataFile.mat

I want then a code block (using =R= in that case) that checks if
"dataFile.mat" is in the working directory with something like:

#+BEGIN_SRC R :var fileName=my-file-name :exports both
  fileName %in% list.files(pattern="*.mat")
#+END_SRC

I'm passing the file name as a variable because I want to repeat the same
analysis on different data files. But I would like to see in the HTML output
the value of the above variable =fileName=. I would like essentially  to
export the expanded source block. Is there a way to do that?

Thanks,

Christophe
-- 

Most people are not natural-born statisticians. Left to our own
devices we are not very good at picking out patterns from a sea of
noisy data. To put it another way, we are all too good at picking out
non-existent patterns that happen to suit our purposes.
Bradley Efron & Robert Tibshirani (1993) An Introduction to the Bootstrap

--

Christophe Pouzat
MAP5 - Mathématiques Appliquées à Paris 5
CNRS UMR 8145
45, rue des Saints-Pères
75006 PARIS
France

tel: +33142863828
mobile: +33662941034
web: http://www.biomedicale.univ-paris5.fr/physcerv/C_Pouzat.html

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

* Re: Question related to org-babel-expand-src-block
  2012-02-02 17:52 Question related to org-babel-expand-src-block Christophe Pouzat
@ 2012-02-03 18:49 ` Eric Schulte
  2012-02-03 20:20   ` Christophe Pouzat
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Schulte @ 2012-02-03 18:49 UTC (permalink / raw)
  To: Christophe Pouzat; +Cc: emacs-orgmode

Christophe Pouzat <christophe.pouzat@gmail.com> writes:

> Hi all,
>
> Using the last org-mode version from the git repository (7.8.03) I've found a
> mismatch between the key-chord required to call function
> =org-babel-expand-src-block= (=C-c C-v v=) and the ones given in the
> info file: =C-c C-v p= or =C-c C-v C-p=. The same goes for the
> [[http://orgmode.org/worg/org-contrib/babel/intro.html][Babel:
> Introduction]] where the given key-chord is =C-c M-b p=. 
>
> In the same line, I have a question concerning the inclusion of the
> /expanded/ source block in the generated output. Let's assume that I
> define in my =.org= file a variable containing a file name like:
>
> #+name: my-file-name
> : dataFile.mat
>
> I want then a code block (using =R= in that case) that checks if
> "dataFile.mat" is in the working directory with something like:
>
> #+BEGIN_SRC R :var fileName=my-file-name :exports both
>   fileName %in% list.files(pattern="*.mat")
> #+END_SRC
>
> I'm passing the file name as a variable because I want to repeat the same
> analysis on different data files. But I would like to see in the HTML output
> the value of the above variable =fileName=. I would like essentially  to
> export the expanded source block. Is there a way to do that?
>
> Thanks,
>
> Christophe

Hi Christophe,

Thanks for reporting the documentation issue, I've just pushed up a
patch which updates the documentation appropriately.

I do not believe there is a way to export an expanded code blocks, and I
fear you may not want to see the variable assignment code in your
export.  You can however use noweb references to achieve the behavior
you are after with the following.

#+name: my-file-name
: dataFile.mat

#+BEGIN_SRC R :exports both :noweb yes
  <<my-file-name()>> %in% list.files(pattern="*.mat")
#+END_SRC

Best,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

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

* Re: Question related to org-babel-expand-src-block
  2012-02-03 18:49 ` Eric Schulte
@ 2012-02-03 20:20   ` Christophe Pouzat
  0 siblings, 0 replies; 3+ messages in thread
From: Christophe Pouzat @ 2012-02-03 20:20 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

Eric Schulte <eric.schulte@gmx.com> writes:

> Christophe Pouzat <christophe.pouzat@gmail.com> writes:
>
>> Hi all,
>>
>> Using the last org-mode version from the git repository (7.8.03) I've found a
>> mismatch between the key-chord required to call function
>> =org-babel-expand-src-block= (=C-c C-v v=) and the ones given in the
>> info file: =C-c C-v p= or =C-c C-v C-p=. The same goes for the
>> [[http://orgmode.org/worg/org-contrib/babel/intro.html][Babel:
>> Introduction]] where the given key-chord is =C-c M-b p=. 
>>
>> In the same line, I have a question concerning the inclusion of the
>> /expanded/ source block in the generated output. Let's assume that I
>> define in my =.org= file a variable containing a file name like:
>>
>> #+name: my-file-name
>> : dataFile.mat
>>
>> I want then a code block (using =R= in that case) that checks if
>> "dataFile.mat" is in the working directory with something like:
>>
>> #+BEGIN_SRC R :var fileName=my-file-name :exports both
>>   fileName %in% list.files(pattern="*.mat")
>> #+END_SRC
>>
>> I'm passing the file name as a variable because I want to repeat the same
>> analysis on different data files. But I would like to see in the HTML output
>> the value of the above variable =fileName=. I would like essentially  to
>> export the expanded source block. Is there a way to do that?
>>
>> Thanks,
>>
>> Christophe
>
> Hi Christophe,
>
> Thanks for reporting the documentation issue, I've just pushed up a
> patch which updates the documentation appropriately.
>
> I do not believe there is a way to export an expanded code blocks, and I
> fear you may not want to see the variable assignment code in your
> export.  You can however use noweb references to achieve the behavior
> you are after with the following.
>
> #+name: my-file-name
> : dataFile.mat
>
> #+BEGIN_SRC R :exports both :noweb yes
>   <<my-file-name()>> %in% list.files(pattern="*.mat")
> #+END_SRC
>
> Best,

Hi Eric,

I agree with you: I don't want to see the variable assignment code in my
export in general – in particular if this means assigning a big matrix to
a variable.
I will try your noweb suggestion for the few cases where I want to
export the assignment.

Thanks for your help.

Christophe 
-- 

Most people are not natural-born statisticians. Left to our own
devices we are not very good at picking out patterns from a sea of
noisy data. To put it another way, we are all too good at picking out
non-existent patterns that happen to suit our purposes.
Bradley Efron & Robert Tibshirani (1993) An Introduction to the Bootstrap

--

Christophe Pouzat
MAP5 - Mathématiques Appliquées à Paris 5
CNRS UMR 8145
45, rue des Saints-Pères
75006 PARIS
France

tel: +33142863828
mobile: +33662941034
web: http://www.biomedicale.univ-paris5.fr/physcerv/C_Pouzat.html

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

end of thread, other threads:[~2012-02-03 20:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-02 17:52 Question related to org-babel-expand-src-block Christophe Pouzat
2012-02-03 18:49 ` Eric Schulte
2012-02-03 20:20   ` Christophe Pouzat

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