From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: [BABEL] Define tables with names in org? Date: Fri, 10 Jan 2014 10:20:43 +0100 Message-ID: <52CFBB6B.5040406@krugs.de> References: <52CE89A9.8060305@krugs.de> <52CEAA76.2090901@krugs.de> <87k3e9j6i3.fsf@gmail.com> Reply-To: Rainer@krugs.de Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1YGp-0003gd-FS for emacs-orgmode@gnu.org; Fri, 10 Jan 2014 04:20:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1YGk-0007Eu-0i for emacs-orgmode@gnu.org; Fri, 10 Jan 2014 04:20:51 -0500 Received: from mail-we0-f182.google.com ([74.125.82.182]:35459) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1YGj-0007Ep-NY for emacs-orgmode@gnu.org; Fri, 10 Jan 2014 04:20:45 -0500 Received: by mail-we0-f182.google.com with SMTP id q59so3734770wes.41 for ; Fri, 10 Jan 2014 01:20:45 -0800 (PST) In-Reply-To: <87k3e9j6i3.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: emacs-orgmode , Christian Moe -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 01/09/14, 20:25 , Eric Schulte wrote: > Rainer M Krug writes: > >> On 01/09/14, 13:30 , Christian Moe wrote: >>> >>> Rainer M Krug writes: >>> >>>> I would like to define a table with named columns and rows, >>>> so that the table is passed to R including the column and row >>>> names - is this possible? >>> >>> Yes, just use the leftmost column for row names and include >>> the header argument :rownames yes. >>> >>> By default, the first row will be used for column names if >>> followed by a hline. Without a hline, use :colnames yes. >>> >>> E.g.: >>> >>> #+name: colrownamestbl | | Alpha | Beta | Gamma | >>> |--------+-------+------+-------| | First | A1 | B1 | C1 >>> | | Second | A2 | B2 | C2 | | Third | A3 | B3 | >>> C3 | >>> >>> #+begin_src R :var data=colrownamestbl :rownames yes :results >>> output colnames(data) rownames(data) #+end_src >>> >>> #+RESULTS: : [1] "Alpha" "Beta" "Gamma" : [1] "First" >>> "Second" "Third" >> >> Ah - I see. Nice. Thanks. >> >> One problem though: >> >> I define my variables in the beginning of the document, in a not >> exported heading so that they don't show in the report, and I >> want to have some variables with rownames and some without. Is >> this possible? >> > > See "Indexable variable values" under (info "(org)var"), it may > help. Thanks - but I don't see how this could help me in this case? To correct my example (to fast copy - paste): * INTERNAL VARIABLES :noexport: ** With column names #+NAME: WITH_COLNAMES | | name | |---|---------------| | a | NPPyC | | b | DBBVy | | c | DBRFy | | d | DBSSy | | e | levelstress_2 | #+PROPERTY: var+ WITH_COLNAMES=WITH_COLNAMES ** Without column names #+NAME: WITHOUT_COLNAMES | name | |---------------| | NPPyC | | DBBVy | | DBRFy | | DBSSy | | levelstress_2 | #+PROPERTY: var+ WITHOUT_COLNAMES=WITHOUT_COLNAMES * The code #+begin_src R # here WITH_COLNAMES will have colnames and WITHOUT_COLNAMES not #+end_src * And some more code #+begin_src R # here WITH_COLNAMES will have colnames and WITHOUT_COLNAMES not #+end_src So my concern is not about having rownames where I don't need them, but in having always to enter rownames in the definition (INTERNAL VARIABLES section), as I need them in the WITH_COLNAMES table. Rainer > >> >> * INTERNAL VARIABLES :noexport: >> >> ** Without column names #+NAME: WITHCOLNAMES | name | >> |---------------| | NPPyC | | DBBVy | | DBRFy >> | | DBSSy | | levelstress_2 | #+PROPERTY: var+ >> WITHCOLNAMES=WITHCOLNAMES >> >> ** Without column names #+NAME: COLS_TO_EVAL | name | >> |---------------| | NPPyC | | DBBVy | | DBRFy >> | | DBSSy | | levelstress_2 | #+PROPERTY: var+ >> COLS_TO_EVAL=COLS_TO_EVAL >> >> And this should be valid everywhere where I use WITHCOLNAMES and >> WITHOUTCOLNAMES in R without having to specify :rownames true >> each time? >> >> Rainer >> >> >>> >>> Yours, Christian >>> >> >> -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc >> (Conservation Biology, UCT), Dipl. Phys. (Germany) >> >> Centre of Excellence for Invasion Biology Stellenbosch >> University South Africa >> >> Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 >> 59 98 Fax : +33 - (0)9 58 10 27 44 >> >> Fax (D): +49 - (0)3 21 21 25 22 44 >> >> email: Rainer@krugs.de >> >> Skype: RMkrug > - -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSz7tqAAoJENvXNx4PUvmCfYUH/i9HoQyLcOxgrdQbfCjjHbft WHbclImYXB7IPtCFb9j3M07IpwompjJU9fQpiRLudYgFlLqIre9qhM+uSxnVdbYo 82dKVORwfN+oZYG4+EwEV5v/aO7L6DhS90EZCik1e5jRUzLpyMrCHEyJEFZsLmIJ UT4emf4IA6qxhRdt0ulNeuu4TSUyYxD9+otx85hvPXkwCUzYoOJ26KRfAbX2sY/P E3OJ4g+tm7zU8GzH+7KMDCkOROTKlYfIMos+XisrQOrL1MdohVMISdrs63zXQRal WEGcTjMuXCXEoX6KGYmUCc4pS5WdALNObcd/9P3NFUm1Zd8DH95FDkWJT53inpE= =B5r8 -----END PGP SIGNATURE-----