Hello Charles & William,
Berry, Charles writes:
> data.frame($data) is not valid R syntax. If you are new to R doing some
> tutorials will help.
>
> I suggest you use C-c C-v C-v (org-babel-expand-src-block) to see what the R
> code is and debug the result given in the the *Org Babel Preview...
The Org table is passed in to R as a data.frame, so all you need is this at the
start (with stringr loaded in previously):
#+begin_src R :session :colnames yes :var data=query
t <- str_split_fixed(data$te, " ", 3)
colnames(t) <- c('date','cycle','energy')
t
#+end_src
#+RESULTS:
|dat
> On May 28, 2021, at 8:52 AM, Roger Mason wrote:
>
> Hello,
>
> I have an SQL source block that returns this:
>
> #+RESULTS: query
>
>
[snip]
> I would like to pass this into R for further processing. At the moment
> I have this:
>
> #+begin_src R :session :colnames yes :var data=quer
Hello,
I have an SQL source block that returns this:
#+RESULTS: query
|date | jid | te | rgkmax |
time | elapsed |
|-+---+--++--+