From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1 with LMTPS id oEaSNrnXi16SQQAAk0OIDg (envelope-from ) for ; Tue, 07 Apr 2020 01:30:33 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id SJbSF7jXi16NfwAA1q6Kng (envelope-from ) for ; Tue, 07 Apr 2020 01:30:32 +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 5BF17945E8D for ; Tue, 7 Apr 2020 01:26:56 +0000 (UTC) Received: from localhost ([::1]:39618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLd0v-0006rd-GD for larch@yhetil.org; Mon, 06 Apr 2020 21:26:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34868) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLd0L-0006rU-Hb for emacs-orgmode@gnu.org; Mon, 06 Apr 2020 21:26:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLd0K-000314-6A for emacs-orgmode@gnu.org; Mon, 06 Apr 2020 21:26:17 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]:33397) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLd0K-00030j-0t for emacs-orgmode@gnu.org; Mon, 06 Apr 2020 21:26:16 -0400 Received: by mail-ot1-x331.google.com with SMTP id 22so1502424otf.0 for ; Mon, 06 Apr 2020 18:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HQMKLkrC8rbuaI2yV6nUweNa8U4t0ufg1/jW9IG2jr4=; b=eGN0GukJ5+y6iIto5UER9aQsY/giQRgOu03XnjsNideWGTrMOSWmFfQA+h61n7t4Ty d1uMEOEyarupNczaYK41y+jhpu/laHeWuntBNrl7ST7i+OjOx3yb9fDTmOrlxsiJQGSJ QUsqRTBGikvvOWQlXJOYedRMTWRCk9hUp7WZsGm8gC7jPTDP9LQZls/DU0KmtUHk5S6u DfGq8v2Bc/qdfrWFd9dQy+48ljzr0PfIiInu+6OpiUt6nsffIV5vPhvu6bGWSjN2hT8o iCFy1RWPq/bR2s7HTXRTJuRWyqUmx8gvB4QnderLEyfXsAtHEjIQ0PJbn4mOMI7l71Km f2lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HQMKLkrC8rbuaI2yV6nUweNa8U4t0ufg1/jW9IG2jr4=; b=alDPstewikt934WF6L0nCaiiuxx9O2/7ObRh+GgBCUMnpj4Jn23EdgAjMyX17Ase1d ff0OnXxyOwUSJaBRlRHJDcPMqv3FDW0yurX2MBAJCK9qnToBqZsasgE07SiLf3uzuO43 ItdlMUQgI1rXuaZTnihvHllPUKye/6BQFF8UPwHiT88AwsP6HcnY0uMITon6QWurCmKr 3yksTGPvkhf1t0oG0xAuYom1Wpo/0P54+2krVFJ62Gnf72PonPhz9WoFK2zRVbIBH7FU biMXpKx23jSAuGzrmUud33l5hWoE1iiU72Pn0mo5br/4v42RXIfMiDALa33oOYD2+pP7 IcuQ== X-Gm-Message-State: AGi0PuZlM2LQU2pBJMfQgfHE+Uueh1wkq303PsTJ8C8I13OXRI0kkmmB clL8br2Kizr3ZJrZk7s+UJax7nTNYaClmfksbUs= X-Google-Smtp-Source: APiQypJM7H0US9i3AZQBe624dTtLmAF+geFESQXap0BEtkFrwfQTTJLrm89ayMBHks9OfV/M/eGjZT6uWekKudU6eKk= X-Received: by 2002:a9d:7f05:: with SMTP id j5mr20340428otq.312.1586222774753; Mon, 06 Apr 2020 18:26:14 -0700 (PDT) MIME-Version: 1.0 References: <44FD428E-9525-4FE4-88BC-9A906960DD4B@ucsd.edu> In-Reply-To: <44FD428E-9525-4FE4-88BC-9A906960DD4B@ucsd.edu> From: Matt Price Date: Mon, 6 Apr 2020 21:26:04 -0400 Message-ID: Subject: Re: R session and plotting in x11 window To: "Berry, Charles" Content-Type: multipart/alternative; boundary="000000000000061d8a05a2a9455c" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::331 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: , Cc: Org Mode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=default; t=1586222817; 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=HQMKLkrC8rbuaI2yV6nUweNa8U4t0ufg1/jW9IG2jr4=; b=FfOXW9IJwp4jk1QWkpig8luvH7v3EmWkbXvPn3Pt7Qh0eRcONY9PRQoJ6Qi0VaBBwd1Luv HAeleJ6Hw/kx8smVgen8mGsNXYEu2fZIoW3YWQvenvniaT3fw9lRIoD5F1CnlBJ4QAuzEt TffqB/iCUtnYU3gboq9VHUVSoS1R8ao= ARC-Seal: i=1; s=default; d=yhetil.org; t=1586222817; a=rsa-sha256; cv=none; b=k12XGmYzyUF8kOX3KPRX1PshASkFfuzTB1+yX+ykZr3zpIvQgZVu3jjCkmNPnXd65oT+Mu nbZzrxQbEITH7EEaqEZBxVB7lcgyufnq6zbEIS/XQtq31K4s60EKEBEyA55SMqaV4HLrwp 0z51lQ3WK24SAznp86wGStXtAT3ssps= ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=eGN0GukJ; dmarc=pass (policy=none) header.from=gmail.com; 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-Scanner: scn0 X-Spam-Score: -0.21 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=eGN0GukJ; dmarc=pass (policy=none) header.from=gmail.com; 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-Scan-Result: default: False [-0.21 / 13.00]; GENERIC_REPUTATION(0.00)[-0.583085886491]; MX_INVALID(1.00)[cached]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; FREEMAIL_FROM(0.00)[gmail.com]; ARC_SIGNED(0.00)[i=1]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.32), country: US(-0.01), ip: 209.51.188.17(-0.58)]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; TAGGED_FROM(0.00)[larch=yhetil.org]; FROM_NEQ_ENVFROM(0.00)[moptop99@gmail.com,emacs-orgmode-bounces@gnu.org]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_COUNT_FIVE(0.00)[6]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[emacs-orgmode@gnu.org]; HAS_LIST_UNSUB(-0.01)[]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: w8EsDJQcXFAz --000000000000061d8a05a2a9455c Content-Type: text/plain; charset="UTF-8" On Sun, Apr 5, 2020 at 1:19 PM Berry, Charles wrote: > > > > On Apr 4, 2020, at 4:27 PM, Matt Price wrote: > > > > Does anyone know much about the difference between an R session opened > by typing M-x R, and the R session opened by org-babel? > > > Short answer: almost none. > > Long answer: what `org-babel-R-initite-session' and friends do. > :-) thanks, I should have been looking for that > > > > > I'm just learning R and my usual method for learning a language is to > keep a kind of notebook in org with code snippets they I can execute and > iterate on rapidly as I learn. This works great in R when I'm just doing > math. When I am working on plots, it would be nice to have them open up > quickly either in emacs or in the standard x11 window that R session opened > switch M-x R opens up. > > > > I know I can set the src block headers to produ e a file, but when I'm > just iterating rapidly I often switch back and forth between a data output > and a graphical output, and typing/erasing those headers is clunky and > slow. It would be easier to just paste the plot command into the console > and have it pop open the window... But that doesn't seem to work. Anyone > know if I can tweak something to make that possible? > > > > > I sam really puzzled by this. Do you have an ECM that illustrates this? > > Working interactively on my Mac (Quartz - X11 is the device), I routinely > do what you describe - usually working from the src edit buffer - and the > plots are displayed (and older plots are available via clover-left or some > such). > > If I had to guess, I'd say that you are opening an R session, but not > using it. If you execute a src block, but it does not have a `:session' > header, a new instance of R will create a plot file and then exit. If you > look in the default directory, you would see `Rplots.pdf' or some such. > > The only other thing that comes to mind is that you opened a device that > is holding on to all your plots. Try `dev.cur()' in R immediately before > and after you create a plot and see what the result is. > > This was the problem. I don't see that I'm calling dev.set() anywhere but when the session initiates dev.cur() returns null 1 calling dev.set(1) or dev.set(2) launches an R_x11 window and future plots are displayed there. As I say, I'm just learning R, and I don't really understand how the device is set up. I also don't understand why it would be set to X11 in a plain-old R session, but not in an org-babel R session. Most references to "device" in ~ob-R.el~ seem to be managing file outputs, and "X11". For now I don't think I'll explore a proper solution as I'm already pretty far down a rabit hole just learning R at all! But thanks very much for this workaround. Matt > HTH, > > Chuck > > > --000000000000061d8a05a2a9455c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Sun, Apr 5, 2020= at 1:19 PM Berry, Charles <ccberry@health.ucsd.edu> wrote:<= br>


> On Apr 4, 2020, at 4:27 PM, Matt Price <moptop99@gmail.com> = wrote:
>
> Does anyone know much about the difference between an R session opened= by typing M-x R, and the R session opened by org-babel?


Short answer: almost none.

Long answer: what `org-babel-R-initite-session' and friends do.
:-) thanks, I should have been looking for that

>
> I'm just learning R and my usual method for learning a language is= to keep a kind of notebook in org with code snippets they I can execute an= d iterate on rapidly as I learn. This works great in R when I'm just do= ing math.=C2=A0 When I am working on plots, it would be nice to have them o= pen up quickly either in emacs or in the standard x11 window that R session= opened switch M-x R opens up.=C2=A0
>
> I know I can set the src block headers to produ e a file, but when I&#= 39;m just iterating rapidly I often switch back and forth between a data ou= tput and a graphical output, and typing/erasing those headers is clunky and= slow. It would be easier to just paste the plot command into the console a= nd have it pop open the window... But that doesn't seem to work. Anyone= know if I can tweak something to make that possible?
>


I sam really puzzled by this. Do you have an ECM that illustrates this?

Working interactively on my Mac (Quartz - X11 is the device), I routinely d= o what you describe - usually working from the src edit buffer - and the pl= ots are displayed (and older plots are available via clover-left or some su= ch).

If I had to guess, I'd say that you are opening an R session, but not u= sing it. If you execute a src block, but it does not have a `:session' = header, a new instance of R will create a plot file and then exit. If you l= ook in the default directory, you would see `Rplots.pdf' or some such.<= br>
The only other thing that comes to mind is that you opened a device that is= holding on to all your plots. Try `dev.cur()' in R immediately before = and after you create a plot and see what the result is.

This was the problem. I don't see that I'm ca= lling dev.set() anywhere but when the session initiates dev.cur() returns

null
=C2=A0=C2=A0=C2=A0=C2=A0 1
=

calling dev.set(1) or dev.set(2) launches an R_x11 wind= ow and future plots are displayed there.=C2=A0 As I say, I'm just learn= ing R, and I don't really understand how the device is set up. I also d= on't understand why it would be set to X11 in a plain-old R session, bu= t not in an org-babel R session. Most references to "device" in ~= ob-R.el~ seem to be managing file outputs, and "X11". For now I d= on't think I'll explore=C2=A0 a proper solution as I'm already = pretty far down a rabit hole just learning R at all!=C2=A0 But thanks very = much for this workaround.

Matt
HTH,

Chuck


--000000000000061d8a05a2a9455c--