Hello,
Maxim Nikulin writes:
> Notice that you can get vertical representation of results as a list
> #+begin_src emacs-lisp :results list
>
> The following is a variation of a recipe suggested by Juan Manuel:
>
> #+name: to-column
> #+begin_src emacs-lisp :var lst=()
>(mapcar #'list lst)
> #
On 13/08/2021 21:17, Roger Mason wrote:
I need to extract a column from a table to use as input to a source
block. I want the extracted column to be returned as a column but it is
returned as a row. The following illustrates the problem:
#+name: s1
| scale | scale1 | scale3 | jid |
| -
Hello Juan,
Juan Manuel Macías writes:
> You're welcome. Just a minor fix: although the code works fine,
> naturally the asterisk in `let' was unnecessary. This is a new version
> with the code explained, in case you find it useful:
>
> #+begin_src emacs-lisp :var data=s1 col=3
> (let* (
>
> > t(data=s1[,3])
(sorry, i thought we were in R-land... :(
Hello Roger,
Roger Mason writes:
> Thank you, I think I may be able to get this to work.
You're welcome. Just a minor fix: although the code works fine,
naturally the asterisk in `let' was unnecessary. This is a new version
with the code explained, in case you find it useful:
#+begin_src emacs-
Hello Juan,
Juan Manuel Macías writes:
> #+name: s1
> | scale | scale1 | scale3 | jid |
> | - | 1.00402 | 0.952329 | 1632 |
> | - | 1.00402 | 0.962247 | 1633 |
>
> #+begin_src emacs-lisp :var data=s1 col=3
> (let* ((column (mapcar (lambda (r) (format "%s" (nth col r))) data)))
>
Hello Greg,
Greg Minshall writes:
> Roger,
>
>> Is there some means of changing 'data=s1[,3]' to accomplish this?
>
> there may be some more formal way (and i think some of the
> data.frame.alternative packages, like data.table:: or dplyr::, have
> their own ways), but you might try transposing
>
Hi Roger,
It's a dirty solution, but you can try:
#+name: s1
| scale | scale1 | scale3 | jid |
| - | 1.00402 | 0.952329 | 1632 |
| - | 1.00402 | 0.962247 | 1633 |
#+begin_src emacs-lisp :var data=s1 col=3
(let* ((column (mapcar (lambda (r) (format "%s" (nth col r))) data)))
Roger,
> Is there some means of changing 'data=s1[,3]' to accomplish this?
there may be some more formal way (and i think some of the
data.frame.alternative packages, like data.table:: or dplyr::, have
their own ways), but you might try transposing
> t(data=s1[,3])
cheers, Greg
Hello,
I need to extract a column from a table to use as input to a source
block. I want the extracted column to be returned as a column but it is
returned as a row. The following illustrates the problem:
#+name: s1
| scale | scale1 | scale3 | jid |
| - | 1.00402 | 0.952329 | 1632 |
| -
10 matches
Mail list logo