emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Plotting with R
@ 2021-08-15 13:17 Roger Mason
  2021-08-15 13:31 ` Pedro Bruel
  0 siblings, 1 reply; 4+ messages in thread
From: Roger Mason @ 2021-08-15 13:17 UTC (permalink / raw)
  To: orgmode

Hello,

I want graphics output from R:

#+begin_src R :results output grahics file :file coa_vs_a.pdf :exports results 
library(tidyverse)
library(RPostgreSQL)
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user="rmason",dbname="test")
rs <- dbSendQuery(con,"with CTE as (select split_part(split_part(lattice_out, E'\n', 13), ' ', 18) as c,
 split_part(split_part(lattice_out, E'\n', 11), ' ', 11) as a
 from results where timestamp like '20210814-071%' order by a)
 select cast(a as double precision), cast(c as double precision)/ cast(a as float) as coa from CTE;")
df <- fetch(rs)
theplot <- ggplot(df,aes(x=a,y=coa)) + geom_point()
theplot
#+end_src

What I expect is a file 'coa_vs_a.pdf' on my filesystem & a link to it
in the org buffer.  What I get is a file 'Rplots.pdf' and an empty file
'coa_vs_a.pdf' with a link to the latter in the org buffer.

I've searched this topic and I _think_ the invocation above, one of many
I've tried, should work.

GNU Emacs 27.2 (build 1, amd64-portbld-freebsd11.4, X toolkit, cairo
version 1.16.0, Xaw3d scroll bars)

Org mode version 9.2.3 (release_9.2.3-390-gfb5091 @
/home/rmason/.emacs.d/org-git/lisp/)

Thanks for your help.

Roger


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

end of thread, other threads:[~2021-08-15 14:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-15 13:17 Plotting with R Roger Mason
2021-08-15 13:31 ` Pedro Bruel
2021-08-15 14:14   ` Roger Mason
2021-08-15 14:34     ` Pedro Bruel

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