emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to refer to remote table, in another file, as a source block variable?
@ 2020-08-07 19:27 William Denton
  2020-09-14 21:57 ` William Denton
  0 siblings, 1 reply; 5+ messages in thread
From: William Denton @ 2020-08-07 19:27 UTC (permalink / raw)
  To: emacs-orgmode

I can't figure this one out.  Let's say I have a table in an Org file, like so:

# -----

* Primes

#+NAME: test_table
| number | prime |
|--------+-------|
| two    | yes   |
| three  | yes   |
| four   | no    |

# -----

In another file, I want to bring this table into a source block as a variable. 
If it was the same file, I'd say ":var t=test_table" and that's that.  But 
what's the syntax for a different file?  I can't figure it out from the docs [1] 
and none of my attempts with quotes, file:, etc. work.  It's something like 
this, isn't it?  But what?

#+begin_src R :var t=(remote(table.org::*Primes))
t
#+end_src

Thanks,

Bill

[1] https://orgmode.org/manual/References.html#References
--
William Denton :: Toronto, Canada   ---   Listening to Art: https://listeningtoart.org/
https://www.miskatonic.org/         ---   GHG.EARTH: https://ghg.earth/
Caveat lector.                      ---   STAPLR: https://staplr.org/


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

* Re: How to refer to remote table, in another file, as a source block variable?
  2020-08-07 19:27 How to refer to remote table, in another file, as a source block variable? William Denton
@ 2020-09-14 21:57 ` William Denton
  2020-09-14 23:11   ` John Kitchin
  0 siblings, 1 reply; 5+ messages in thread
From: William Denton @ 2020-09-14 21:57 UTC (permalink / raw)
  To: emacs-orgmode

My apologies for sending this around a second time, but I still haven't got it
so I thought I'd try again.  If it's possible to refer to a remote table in 
another file, I've love to know how.


Bill


On 7 August 2020, William Denton wrote:

> I can't figure this one out.  Let's say I have a table in an Org file, like 
> so:
>
> # -----
>
> * Primes
>
> #+NAME: test_table
> | number | prime |
> |--------+-------|
> | two    | yes   |
> | three  | yes   |
> | four   | no    |
>
> # -----
>
> In another file, I want to bring this table into a source block as a 
> variable. If it was the same file, I'd say ":var t=test_table" and that's 
> that.  But what's the syntax for a different file?  I can't figure it out 
> from the docs [1] and none of my attempts with quotes, file:, etc. work. 
> It's something like this, isn't it?  But what?
>
> #+begin_src R :var t=(remote(table.org::*Primes))
> t
> #+end_src
>
> Thanks,
>
> Bill
>
> [1] https://orgmode.org/manual/References.html#References
> --
> William Denton :: Toronto, Canada   ---   Listening to Art: 
> https://listeningtoart.org/
> https://www.miskatonic.org/         ---   GHG.EARTH: https://ghg.earth/
> Caveat lector.                      ---   STAPLR: https://staplr.org/
>

--
William Denton :: Toronto, Canada   ---   Listening to Art: https://listeningtoart.org/
https://www.miskatonic.org/         ---   GHG.EARTH: https://ghg.earth/
Caveat lector.                      ---   STAPLR: https://staplr.org/


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

* Re: How to refer to remote table, in another file, as a source block variable?
  2020-09-14 21:57 ` William Denton
@ 2020-09-14 23:11   ` John Kitchin
  2020-09-17 21:01     ` William Denton
  0 siblings, 1 reply; 5+ messages in thread
From: John Kitchin @ 2020-09-14 23:11 UTC (permalink / raw)
  To: William Denton; +Cc: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 2161 bytes --]

I think you are looking for (Assuming your table is in an org file called
test.org):

#+BEGIN_SRC ipython :var data=test.org:test_table
for row in data:
    print(row)
#+END_SRC

#+RESULTS:
:results:
# Out [2]:
# output
['two', 'yes']
['three', 'yes']
['four', 'no']

:end:
John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Mon, Sep 14, 2020 at 5:58 PM William Denton <wtd@pobox.com> wrote:

> My apologies for sending this around a second time, but I still haven't
> got it
> so I thought I'd try again.  If it's possible to refer to a remote table
> in
> another file, I've love to know how.
>
>
> Bill
>
>
> On 7 August 2020, William Denton wrote:
>
> > I can't figure this one out.  Let's say I have a table in an Org file,
> like
> > so:
> >
> > # -----
> >
> > * Primes
> >
> > #+NAME: test_table
> > | number | prime |
> > |--------+-------|
> > | two    | yes   |
> > | three  | yes   |
> > | four   | no    |
> >
> > # -----
> >
> > In another file, I want to bring this table into a source block as a
> > variable. If it was the same file, I'd say ":var t=test_table" and
> that's
> > that.  But what's the syntax for a different file?  I can't figure it
> out
> > from the docs [1] and none of my attempts with quotes, file:, etc. work.
> > It's something like this, isn't it?  But what?
> >
> > #+begin_src R :var t=(remote(table.org::*Primes))
> > t
> > #+end_src
> >
> > Thanks,
> >
> > Bill
> >
> > [1] https://orgmode.org/manual/References.html#References
> > --
> > William Denton :: Toronto, Canada   ---   Listening to Art:
> > https://listeningtoart.org/
> > https://www.miskatonic.org/         ---   GHG.EARTH: https://ghg.earth/
> > Caveat lector.                      ---   STAPLR: https://staplr.org/
> >
>
> --
> William Denton :: Toronto, Canada   ---   Listening to Art:
> https://listeningtoart.org/
> https://www.miskatonic.org/         ---   GHG.EARTH: https://ghg.earth/
> Caveat lector.                      ---   STAPLR: https://staplr.org/
>
>

[-- Attachment #2: Type: text/html, Size: 3905 bytes --]

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

* Re: How to refer to remote table, in another file, as a source block variable?
  2020-09-14 23:11   ` John Kitchin
@ 2020-09-17 21:01     ` William Denton
  2020-09-23  7:26       ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: William Denton @ 2020-09-17 21:01 UTC (permalink / raw)
  To: John Kitchin; +Cc: org-mode-email

Aha!  Thank you!  I'll try to do a patch for the docs so this is clearer there.

Bill

On 14 September 2020, John Kitchin wrote:

> I think you are looking for (Assuming your table is in an org file called
> test.org):
>
> #+BEGIN_SRC ipython :var data=test.org:test_table
> for row in data:
>    print(row)
> #+END_SRC
>
> #+RESULTS:
> :results:
> # Out [2]:
> # output
> ['two', 'yes']
> ['three', 'yes']
> ['four', 'no']

--
William Denton :: Toronto, Canada   ---   Listening to Art: https://listeningtoart.org/
https://www.miskatonic.org/         ---   GHG.EARTH: https://ghg.earth/
Caveat lector.                      ---   STAPLR: https://staplr.org/


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

* Re: How to refer to remote table, in another file, as a source block variable?
  2020-09-17 21:01     ` William Denton
@ 2020-09-23  7:26       ` Bastien
  0 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2020-09-23  7:26 UTC (permalink / raw)
  To: William Denton; +Cc: org-mode-email, John Kitchin

Hi William,

William Denton <wtd@pobox.com> writes:

> I'll try to do a patch for the docs so this is clearer there.

TIA!

-- 
 Bastien


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

end of thread, other threads:[~2020-09-23  7:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-07 19:27 How to refer to remote table, in another file, as a source block variable? William Denton
2020-09-14 21:57 ` William Denton
2020-09-14 23:11   ` John Kitchin
2020-09-17 21:01     ` William Denton
2020-09-23  7:26       ` Bastien

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