Re: return column from table as a column

2021-08-17 Thread Roger Mason
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) > #

Re: return column from table as a column

2021-08-14 Thread Maxim Nikulin
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 | | -

Re: return column from table as a column

2021-08-14 Thread Roger Mason
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* ( >

Re: return column from table as a column

2021-08-13 Thread Greg Minshall
> > t(data=s1[,3]) (sorry, i thought we were in R-land... :(

Re: return column from table as a column

2021-08-13 Thread Juan Manuel Macías
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-

Re: return column from table as a column

2021-08-13 Thread Roger Mason
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))) >

Re: return column from table as a column

2021-08-13 Thread Roger Mason
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 >

Re: return column from table as a column

2021-08-13 Thread Juan Manuel Macías
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)))

Re: return column from table as a column

2021-08-13 Thread Greg Minshall
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

return column from table as a column

2021-08-13 Thread Roger Mason
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 | | -