From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id sOk8M+4RsWCDcwEAgWs5BA (envelope-from ) for ; Fri, 28 May 2021 17:53:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id mMeKLu4RsWD+bQAAbx9fmQ (envelope-from ) for ; Fri, 28 May 2021 15:53:18 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3C9BFAB24 for ; Fri, 28 May 2021 17:53:18 +0200 (CEST) Received: from localhost ([::1]:34770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lmenV-0005C5-Ad for larch@yhetil.org; Fri, 28 May 2021 11:53:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmen6-00059d-JY for emacs-orgmode@gnu.org; Fri, 28 May 2021 11:52:52 -0400 Received: from esa01.ucs.mun.ca ([134.153.136.21]:19653) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmen3-0002V8-DD for emacs-orgmode@gnu.org; Fri, 28 May 2021 11:52:52 -0400 IronPort-SDR: yHpQvD0fDiiVktR6HSlu5/FGoz0QsDZoss0zpQFoyCoOWsaX0s5nq9QtAQheanDlt7MXKQzbV6 foFmAgn9U5muuDnGNKdiiyhk4D2zOZdZddThNBmKc0Ln/EqM0tCMOiW35YBiw0J7BiyhWyvtfU TFKBzWjBmSgrBW8fmpaccavc2ynPlAR/tXC9VkPOs8V5T4ro2jmsGjg/FWGBh4lYkJCO1TYmlK KhZl76xQh1OE82Oywl/AihYEBbe3PC2atvBPRJXYYliE1iz9styMKrzlbIWPPuxr0OKMCnYE14 /Zk= IronPort-HdrOrdr: =?us-ascii?q?A9a23=3Ac5NNw68hmvk5xd+mKF9uk+DFI+orL9Y04l?= =?us-ascii?q?Q7vn2ZKCY0TiX2ra+TdZggvyMc6wxxZJhDo7690cC7KBvhHPVOjbX5U43OYC?= =?us-ascii?q?DbomeyaIlt4Yz+qgeKJxHD?= X-IronPort-AV: E=Sophos;i="5.83,229,1616466600"; d="scan'208";a="63943344" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from cpe00fc8db7a323-cm00fc8db7a320.cpe.net.cable.rogers.com (HELO pyrope.local) ([174.117.202.255]) by smtp01.ucs.mun.ca with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2021 13:22:47 -0330 User-agent: mu4e 1.5.6; emacs 27.2 From: Roger Mason To: emacs-orgmode@gnu.org Subject: Passing a variable into an R source block. Date: Fri, 28 May 2021 13:22:44 -0230 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=134.153.136.21; envelope-from=rmason@mun.ca; helo=esa01.ucs.mun.ca X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622217198; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=Njv7nG054Zus4K6bcoVGBRjCzBB27PAZV8U62lGAutg=; b=QYQOXj35pT1ZObfuJL5ItvDybw1i1ExwsJg1F2SsQLZz0e57M+iMD85kmtYjiDuMfMiSb7 D6AQbH3/snQVbezN7n1h816IxjbDIWlLLzf9X3+nAEMusXvF3Wk4rmR57+oWBkF+z7YeJA DBS+tyQUrAN2yg+zjp6dgfG88nP9L+9pS7WyuwfTSN5giiQ8/d2qFu3HBoc5D+CM1GdZlV OHyz/Wci3LC7Q0SwYi1TUfnVv2ceAuFMO0OdRoqdqJRYeadoyBEEFs7AtRAIAmEFYeZ69B EFqGk/oVGo01mzs4ljthwG2P2nJhBvzId0Td7tSclpCRci45/zeAzXt0/PlKQg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622217198; a=rsa-sha256; cv=none; b=r+7WLNPoE70gr9dWPsQ8aPAh7oUONfNhz0NJv5kln1Tbi5EKuhpadb0o6iBgNSkDl7ptB8 hcDU0BUZKW9EzNwL+CkXzz9ejT2JtYj7GEI40Tsn/QjXgWT5kxw9gOXpyA4eWeBueUjKTR 6LfHbQ6E3b4h5D8vdbmMNnelWBW9vWjp8oxa7B+DQalxbjbPwFL1abaRHFd4/Tks5Ku8xD OUozhtXxLYPCPuP0xnrZTJ2/oMRpe/gfumouYcMHOUqYk3Ep+QowObdfr1dYocIL7vsBwO kbGiGD3iDFXHysJCzIap0dOp8iW6/kbVShcrbcKUJgSTSKGysL2b+5LikY1p6g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.43 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 3C9BFAB24 X-Spam-Score: -2.43 X-Migadu-Scanner: scn0.migadu.com X-TUID: ibPUpRE90aFw Hello, I have an SQL source block that returns this: #+RESULTS: query | date | jid | te | rgkmax | time | elapsed | |-----------------+-------+----------------------------------+--------+----------+-------------------------------| | 20210528-053900 | 647_1 | 20210528-053900 1 -1333.58106425 | 7 | 01:00:00 | Job Wall-clock time: 00:03:16 | | 20210528-053900 | 647_1 | 20210528-053900 2 -1333.25006295 | 7 | 01:00:00 | Job Wall-clock time: 00:03:16 | | 20210528-053900 | 647_1 | 20210528-053900 3 -1332.40596663 | 7 | 01:00:00 | Job Wall-clock time: 00:03:16 | | 20210528-053900 | 647_1 | 20210528-053900 4 -1327.18802970 | 7 | 01:00:00 | Job Wall-clock time: 00:03:16 | | 20210528-053900 | 647_1 | 20210528-053900 5 -1320.63944318 | 7 | 01:00:00 | Job Wall-clock time: 00:03:16 | 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=query r <- data.frame($data) t <- data.frame( str_split_fixed(r$te, " ", 3) ) colnames(t) <- c('date','cycle','energy') df <- data.frame(r$date,r$jid,t$cycle,t$energy,r$x,r$time,r$elapsed) # colnames(df) <- c('date','jid','cycle','energy','time','elapsed') # df <- transmute(df,date,jid,cycle,energy,time,elapsed = str_remove(elapsed,"Job Wall-clock time: ")) # tail(filter(df,jid == '$jid'),1)$energy #+end_src and the output is: /tmp/unknown!4fCXoM:20:17: unexpected '$' 19: }) 20: r <- data.frame($ I presume that is because R uses '$' to select a column from a data frame. I tried quoting like this: r <- data.frame("$data") but the output is then: #+RESULTS: | t.cycle | t.energy | |---------+----------| whereas I was expecting 7 columns of data from data frame 'df'. I don't know if this is an org problem or an R problem, but if someone can cast light on it, please do. Thanks, Roger 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/)