From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id EGLNM5CrYGYMXwEAqHPOHw:P1 (envelope-from ) for ; Wed, 05 Jun 2024 20:16:48 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id EGLNM5CrYGYMXwEAqHPOHw (envelope-from ) for ; Wed, 05 Jun 2024 20:16:48 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=NCRP3W9V; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1717611408; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=AeLCYZVrd+FkimcNQnXurWtnwVIxs4LPH5/4gSN3LXo=; b=SphqHBcCTD5ZJij/FrxQOaX+d9T+jdbCShcDyTCfQ1mv9AU3Yuzbw9mvWVOoYAsMocWFx+ gDzpperP4NdEbGROXukl7im5Hvlz2I8CR2TssUSctImCgK71uC+WdlVaxxeoCDC44MiAlA /x3TwOQ5AKvFcHbsHrFVD/015HfWNdg7zv6K31upelX1nCeqtE7ub8d/K8DOiWG5O6JJTY dQsi3SU95YIv88/20GCrp5ARbJ2GwOLbdAMjcjNDs3TrXrGcSnP8GfUvuM32ODGf2kXJ4h evYt3rSF6ls/ph3NIKvZg3ie8zc7NE+Uyxe2E5q89QJ7x1R7DiX/mVnAZvi1vQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=NCRP3W9V; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1717611408; a=rsa-sha256; cv=none; b=JROIjC9OQ+F1QL/akhTbrewUhB0cd9ze1pYNsgfrCbQnd+bOi2e4MXBFHfCalp7acjvRao B+04c6hzthDdkMmpzdMrGgg8qFB/uNWp5fUjqg5oat1F92kokHT758SdFF+GQspCWNBFVu Zwx6WqJU6W+dg0ezVpMNC9073ymqr/My+SbK427h+BJ9xlsTtLP3N0zklu+60JtezQKhp5 CIbTxFwLMXfQ3VrP1/xbuIiHLkREWw/xLnwIGRQ1pTEY9j3RXPqJXt9UbyKTb8MvJGTdrJ +PY8frK3uhJ1yxVoWefUdAeChwnmx/GplzeOxzUCatuSHAEGCixHXqoGkkvgfQ== 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 AEA08111ED for ; Wed, 5 Jun 2024 20:16:48 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sEvAo-0004NE-GT; Wed, 05 Jun 2024 14:15:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEvAj-0004Mm-5S for emacs-orgmode@gnu.org; Wed, 05 Jun 2024 14:15:41 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEvAg-0000b6-E9 for emacs-orgmode@gnu.org; Wed, 05 Jun 2024 14:15:40 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id E5AF8240027 for ; Wed, 5 Jun 2024 20:15:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1717611335; bh=q6snWmepkEWaM9MjdKNqqGtZIPffBUDHMHNYOdP/LJs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=NCRP3W9VtLXdBUivqbXbfMcbFc0+eU/AGXZHm3RWAeRWyNfBMVNmEDrjXXZdrS5NM p+Y2B/MujYRs0H79nhVsmEe2qG7AkZwCzeSd9aQ9hnvoxWMGwwaRNymBkXIPfFgtS3 WdBAJmyvzrXYU3RC/eM1TM4/AE4v43cHvT4LlZEycz4u0pdT9lqPQmlV1HtCWO2yGR m39/3zvsMIlnmu1lAjkw6htnhYeuCE/quV8S3fUXsZPGkWTMjW2Hu78Eggkk+vTk6w yYWavxa/JZufEXzihKzebNZpqdLFR17EGE476aLM9DdhOMv8HHwlrrhWPkysEK6fm0 V2FMjzoAWPiMg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VvbHC37yVz6tvJ; Wed, 5 Jun 2024 20:15:34 +0200 (CEST) From: Ihor Radchenko To: "Berry, Charles" , Jeremie Juste , Jack Kamm Cc: Giuseppe Pagnoni , "emacs-orgmode@gnu.org" Subject: [FR] Org babel: mixing multiple outputs (was: Output of R code block: only text or plot but not both? And only one "result" can be output?) In-Reply-To: <279D1AD1-F38A-4442-AE06-60CFA0798874@health.ucsd.edu> References: <279D1AD1-F38A-4442-AE06-60CFA0798874@health.ucsd.edu> Date: Wed, 05 Jun 2024 18:17:08 +0000 Message-ID: <87cyov5k63.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.56 X-Spam-Score: -9.56 X-Migadu-Queue-Id: AEA08111ED X-Migadu-Scanner: mx13.migadu.com X-TUID: UsoUPBewxivm "Berry, Charles" writes: >> I am trying to have an R code block output both the results of a numerical expression AND a plot, but if I set up the header arguments to display the plot, the numerical outcome is not displayed. A simple example: >> >> #+begin_src R :file example.png :results output graphics file >> x <- rnorm(100) >> print(mean(x)) >> hist(x) >> #+end_src >> > > > Babel is a great tool, but has some inherent limitations. While it is currently not directly possible to get a mix output and graphics results, this is _not_ inherent limitation. One can write a patch for ob-R to produce output type that mixes all the block results, including textual output, graphical output, and any other perceivable output. Such patch would be a reasonable addition to babel backends like ob-R or ob-python. > Whilst you can work around this by breaking the above block into > multiple src blocks, you might have an easier time using ox-ravel > [1]. Basically, you export your *.org document to one of the > knitr/Rmarkdown/quarto formats (e.g. *.Rmd) and then render the final > output using one of those engines. This gives you access to the > capabilities of any of those engines. The downside, of course, is > that you need to learn a bit about the formatting rules in one of them > to fine tune your final output. > > FWIW, I copy and pasted your query to a `*.org` file, exported it to > `*.Rmd` with the latest ox-ravel version and rendered it as html - > displaying all the printed output and all three plots. That did not > need any modifications to your markup. Thanks for sharing the project! Although, I would not call going through double export, and producing html output "easier time". While we are here, are there any other features you find missing in Org babel that are present in knitr/Rmarkdown/quarto? -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at