From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MIfZBYgT3mHQ7AAAgWs5BA (envelope-from ) for ; Wed, 12 Jan 2022 00:32:24 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id UH1NA4gT3mGXkAAA9RJhRA (envelope-from ) for ; Wed, 12 Jan 2022 00:32:24 +0100 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 AE5B12D606 for ; Wed, 12 Jan 2022 00:32:23 +0100 (CET) Received: from localhost ([::1]:44404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n7Qcn-0004MS-9O for larch@yhetil.org; Tue, 11 Jan 2022 18:32:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7QbY-0004Hv-NW for emacs-orgmode@gnu.org; Tue, 11 Jan 2022 18:31:04 -0500 Received: from [2607:f8b0:4864:20::931] (port=33340 helo=mail-ua1-x931.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n7QbW-0005NU-Ql for emacs-orgmode@gnu.org; Tue, 11 Jan 2022 18:31:04 -0500 Received: by mail-ua1-x931.google.com with SMTP id u6so1703436uaq.0 for ; Tue, 11 Jan 2022 15:30:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=bM1Tk5DyfDX6lc+t8838hgckWwqGb1QJsp96k9NkhFw=; b=ammcOSSPVsddYcwHwLY2weFcg5Wjw/m+3CusY/M6wbm/halRDntvaP5l25VJWyuf8/ alBGIegMIFz57I/hblLxGaOfyDO/n1yfCcDetvG4NGJhRQwnJtZYU0cSc0fitns5AsB6 xpFtZ9amnSHwN4B9hC0MInECLJbafzBL2MzuB52d8ncBIoJaXiC28C3SDOnQA0mJ9MTP XWnIK+/fKYkglGUKZ6H4tMhhdQbhgdGUl6mvG18ehG9xTjFcBt37UvCPRHfjDvzlmGVK K14fjbq+rMrd/KIkNqFJqhkxC5XHWtno8eyy17SOZInwV00o9eagG/cNfMG7+qH8/h6V aU4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=bM1Tk5DyfDX6lc+t8838hgckWwqGb1QJsp96k9NkhFw=; b=xvhXBJJ5A2HDks0XwH6lqckU4p0J13Oppj8yaPtsrD7Vmql3/hPDtn+ab2wLrdkXB/ IYYjnMCU7o4CWi3/SZgalofioJQal+FaUxxTZZH2KrC1zE6ImcTSEcUXCxcPcACCVfRU 0etgpaV6L4w0fJriNb4vX7H/l/wpH4IfG9rRbfrZPWdV21JNZhLf6KC17zog/IXSh+P1 XBifWjEv6cZaLENReCYyC34lp8lZp1c+0eYVHeK6GpFUAB31iT0Ix/ghwTYLLDicXy7Y c3la8x/o4Qf1+iL0n8k5ko5RO1CnD+R4i8fYmvke1lycCSKRzsJoeV9UhWgORSt6le3w Kwyg== X-Gm-Message-State: AOAM532ymwL5n1u0ja3t7yVOFL/ELZF26AuLAas6XT8z3u7ixDrge/Ci v6XjkeSbz08oS5W6ADkRvacQK3oxQb1YmdAyXiJxjzHttgOAkw== X-Google-Smtp-Source: ABdhPJwUL5fDUJLRF0NrhO/0mIk2tRdVWnOq1lkdrPL2h/+VfjKB51i5ffT8oJyJu5m7HfeWiZ5s0kM1juDioQ7vo94= X-Received: by 2002:a67:e3a7:: with SMTP id j7mr2078585vsm.81.1641943852166; Tue, 11 Jan 2022 15:30:52 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: John Hendy Date: Tue, 11 Jan 2022 17:30:41 -0600 Message-ID: Subject: Re: R terminal output does not match src block output due to ">" character in results To: emacs-orgmode Content-Type: text/plain; charset="UTF-8" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::931 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::931; envelope-from=jw.hendy@gmail.com; helo=mail-ua1-x931.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 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 X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1641943943; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=bM1Tk5DyfDX6lc+t8838hgckWwqGb1QJsp96k9NkhFw=; b=u27bKz7FhP2BDBYHhDSgA9/RTTqM9bzkSLxjzVsGFVcnV0fcWE5tiH9UHg73BkkFWaoLQ2 QeAOd9TDv88PIpgoXd6L6memQ3E8cfcwBWisYMlC7Ni4uTXrZ/oObYo/KirZXEVityz2dS MqB5NviNiijOIE7ADO5n+C8r+5EkOhETa1KsP8IqftG5ckXMmRCOQOA7uYfMgkpSxYKJvB wDSyFtCmwYQ1KSR3NSd8bYJKiX1/gr5im+IPPbFu/C+Ds0hvBDn8vPO4ftU78ruWS4+bAW TekilSPNrdHNK0MgQTY4SfmI8CIR4vMlm8kpFO0X9A+YxKahcv7/W0Mau+N3uA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641943943; a=rsa-sha256; cv=none; b=VTlhE5dvpKHECBXGQAKGBy/KTXN1HZ8LHb34IikREyfZxZx+cq4YW7sbwjnhKfEPMRpV+c a+gD8COw9pViXwbtHz16PH8GiLo9t/qayPVTlMKFJ4SJ1vBaTmN9xDSu98rOf0/G0DvxPl ECMAaVu8Jlclx4veYcwTBKM4hxTDsrrKXRUVT0EuLqn7mvqOw1rq7MdGRRbIg4VfHANEUE avmXgaaOpBzhA6Qvr3gA8qrO4oeD+qo/NM2qdhepoOBQ5z17t0+SjZEFRYdcVWjV9HSgki 4N0wsI+ZCrjE7ekxple/Oc1nwTlH5tZsjzDGe/GGXr+A8GKrPhAtw87PSJ1zAA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ammcOSSP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -4.32 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ammcOSSP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: AE5B12D606 X-Spam-Score: -4.32 X-Migadu-Scanner: scn0.migadu.com X-TUID: bYKZUzz97yT+ Ok, after more searching, I found that this is a duplicate issue that's already been discussed. Not sure why all my incantations didn't bring me to the reddit post or mailing list from google, but simply searching "prompt blocks R" on r/orgmode directly got me here: https://www.reddit.com/r/orgmode/comments/pt3em4/source_block_modifying_format_of_results_r/ And that links to a patch: https://gist.github.com/gtuckerkellogg/e356d20497cfdc8e4fc683412e320e3e And that points to this mailing list thread where the topic has already come up: https://list.orgmode.org/87zgxc42qg.fsf@gmail.com/ It appears the discussion/fix is stalled out at this point? Best regards, John On Tue, Jan 11, 2022 at 4:42 PM John Hendy wrote: > > I just ran into an issue where results look fine in the terminal, but > not in the results of a source block. I can't share the real example > as it's work confidential, but a couple of rows across 7 columns looks > like this in the terminal: > > #+begin_example terminal > dbGetQuery(con, paste0("SELECT TOP 2 * FROM table")) > 1 NA NA FALSE 0 5 > 2 NA NA FALSE 0 5 > #+end_example > > When I use this with :exports results :results output drawer in my > document, I get: > #+begin_example src > 1 < > NA NA < > FALSE 0 5 > 2 < > NA NA < > FALSE 0 5 > #+end_example > > I had an entirely separate email written and about to send, when it > dawned on me that the > character is the same as the R terminal prompt > and might be the cause. > > My first attempt to reproduce was unsuccessful: > > #+begin_src R :session :exports results :results output drawer > df <- data.frame( > x = letters[1:3], > y = c(1, 2, NA), > z = c("x", NA,"z")) > df > #+end_src > > #+RESULTS: > :results: > x y z > 1 a 1 x > 2 b 2 > 3 c NA z > :end: > > I'm not sure if it's about more columns or more rows, but this does the trick: > > #+begin_src R :session :exports results :results output drawer > df <- data.frame( > x = letters[1:7], > y = c(1, 2, NA, NA, NA, NA, NA), > z = c("x", NA, NA, NA, NA, NA, "z"), > a = c(1, rep(NA, 6))) > df > #+end_src > > #+RESULTS: > :results: > x y z a > 1 a 1 x 1 > 2 b 2 < > NA > 3 c NA < > NA > ### ... shortened > :end: > > If you comment out the line with z=, it works again... but that's the > column with all the values. Then again, if you end the data.frame > at z and don't add column a, it *also* works despite the presence of > many values. > > #+RESULTS: > :results: > x y z > 1 a 1 x > 2 b 2 > 3 c NA > ### ... shortened > :end: > > I'm imagining there's a... "parser?" somewhere that typically strips > off the command prompt from the results perhaps (and recall some vague > memory of someone telling me this years ago on the list). Is there a > way to stop this from happening? > > Would this line be responsible, or something else? > https://github.com/bzg/org-mode/blob/main/lisp/ob-R.el#L453 > > > Many thanks, > John