* :var problems with R
@ 2012-06-21 6:14 Neuwirth Erich
2012-06-21 7:04 ` suvayu ali
2012-06-21 16:02 ` Thomas S. Dye
0 siblings, 2 replies; 4+ messages in thread
From: Neuwirth Erich @ 2012-06-21 6:14 UTC (permalink / raw)
To: emacs-orgmode
The following works
#+name: xvar
#+begin_src emacs-lisp
"ahaRx"
#+end_src
#+RESULTS: xvar
: ahaR
#+name: myblock
#+begin_src R :var xxx=xvar
xxx
#+end_src
#+RESULTS: myblock
: ahaRx
But when I replace emacs-lisp with R in the first code block, it does not work any more.
I think it should because R also returns the character value in that case.
Any ideas?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: :var problems with R
2012-06-21 6:14 :var problems with R Neuwirth Erich
@ 2012-06-21 7:04 ` suvayu ali
2012-06-21 18:26 ` Neuwirth Erich
2012-06-21 16:02 ` Thomas S. Dye
1 sibling, 1 reply; 4+ messages in thread
From: suvayu ali @ 2012-06-21 7:04 UTC (permalink / raw)
To: Neuwirth Erich; +Cc: emacs-orgmode
Hi Neuwirth,
On Thu, Jun 21, 2012 at 8:14 AM, Neuwirth Erich
<erich.neuwirth@univie.ac.at> wrote:
> The following works
> #+name: xvar
> #+begin_src emacs-lisp
> "ahaRx"
> #+end_src
Why are you not using something that you know works? Try the following
for example.
#+name: xvar
|"ahaRx"|
#+name: myblock
#+begin_src R :var xxx=xvar
xxx
#+end_src
#+RESULTS: myblock
: ahaRx
As I understand it, Babel can read from tables and lists only.
Actually, to me, reading from a block of text doesn't make much sense
for a source block. What kind of data structure would it represent
(other than a long string of course :-p)?
GL
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: :var problems with R
2012-06-21 7:04 ` suvayu ali
@ 2012-06-21 18:26 ` Neuwirth Erich
0 siblings, 0 replies; 4+ messages in thread
From: Neuwirth Erich @ 2012-06-21 18:26 UTC (permalink / raw)
To: suvayu ali; +Cc: emacs-orgmode
Meanwhile I learned that
#+name: xvar
: waterfall
#+name: myblock
#+begin_src R :var xxx=xvar
print(xxx)
#+end_src
#+RESULTS: myblock
: waterfall
ans so will
#+name: xvar2
: water
#+name: myblock2
#+begin_src R :var xxx=xvar2
xxx
#+end_src
#+RESULTS: myblock2
: water
The critical missing piece for me was the colon in front of the value in a name definition.
I wanted this because I am running a project on different machines, and I want to give the
name od subdirectories through this mechanism.
Ir seems cleaner than using code in a programming language when we just need constants.
And I explained the problem seems to be that a value returned by R in a named block is not accessible
as a named "variable".
In this case, I would rather stay with R which I need anyhow and I have to explain to my coworkers.
Using emacs-lisp additionally would just make things harder to understand fore some of the project members.
This also works now
#+name: rvar
#+begin_src R
"raha"
#+end_src
#+RESULTS: rvar
: raha
#+name: rvartest
#+begin_src R :var xxx=rvar
xxx
#+end_src
I had misunderstood something there.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: :var problems with R
2012-06-21 6:14 :var problems with R Neuwirth Erich
2012-06-21 7:04 ` suvayu ali
@ 2012-06-21 16:02 ` Thomas S. Dye
1 sibling, 0 replies; 4+ messages in thread
From: Thomas S. Dye @ 2012-06-21 16:02 UTC (permalink / raw)
To: Neuwirth Erich; +Cc: emacs-orgmode
Neuwirth Erich <erich.neuwirth@univie.ac.at> writes:
> The following works
> #+name: xvar
> #+begin_src emacs-lisp
> "ahaRx"
> #+end_src
>
> #+RESULTS: xvar
> : ahaR
> #+name: myblock
> #+begin_src R :var xxx=xvar
> xxx
> #+end_src
>
> #+RESULTS: myblock
> : ahaRx
>
> But when I replace emacs-lisp with R in the first code block, it does
> not work any more.
> I think it should because R also returns the character value in that case.
>
> Any ideas?
>
This works here:
#+name: xvar
#+begin_src R
"ahaRx"
#+end_src
#+RESULTS: xvar
: ahaRx
#+name: myblock
#+begin_src R :var xxx=xvar
xxx
#+end_src
#+RESULTS: myblock
: ahaRx
You don't say what doesn't work, which makes it difficult to diagnose
what might be going wrong on your end.
All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-21 18:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-21 6:14 :var problems with R Neuwirth Erich
2012-06-21 7:04 ` suvayu ali
2012-06-21 18:26 ` Neuwirth Erich
2012-06-21 16:02 ` Thomas S. Dye
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).