<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: R integration, issue with R Submit File in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/R-integration-issue-with-R-Submit-File/m-p/588685#M79366</link>
    <description>&lt;P&gt;And I do not need the &lt;FONT face="courier new,courier"&gt;windows()&lt;/FONT&gt; function call either. Just explicitly plotting by calling the &lt;FONT face="courier new,courier"&gt;plot&lt;/FONT&gt; function is sufficient!&lt;/P&gt;&lt;P&gt;I did find that the JMP error message (&lt;FONT face="courier new,courier"&gt;"Get data for "png" failed"&lt;/FONT&gt;) disappears once I use the &lt;FONT face="courier new,courier"&gt;windows&lt;/FONT&gt; function call in R. I just end up with an empty window as nothing is explicitly plotted to it.&lt;/P&gt;&lt;P&gt;The code below works fine in conjunction with the JSL scipt using &lt;FONT face="courier new,courier"&gt;R submit File&lt;/FONT&gt;.&lt;/P&gt;&lt;PRE&gt;library(dplyr)
library(ggplot2)
library(palmerpenguins)

p &amp;lt;- ggplot(data = penguins, aes(x = bill_length_mm, y = flipper_length_mm, colour = species)) +
  geom_point() +
  facet_wrap(. ~ island, nrow = 3)
&lt;FONT color="#FF0000"&gt;plot(p)&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Jan 2023 01:15:35 GMT</pubDate>
    <dc:creator>paul_vanoppen</dc:creator>
    <dc:date>2023-01-11T01:15:35Z</dc:date>
    <item>
      <title>R integration, issue with R Submit File</title>
      <link>https://community.jmp.com/t5/Discussions/R-integration-issue-with-R-Submit-File/m-p/588025#M79318</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Update: I found a workaround which I posted in the comments.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;This JSL script runs without any problems (I am using JMP 16.0.0 (512257) under Windows 10 Pro 64 bit) and generates the expected png output from &lt;FONT face="courier new,courier"&gt;ggplot&lt;/FONT&gt; in JMP:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;LoadExprs = Expr(
	InitR = Expr(
		R Init();
		
		R Submit( "
			library(dplyr)
			library(ggplot2)
			library(palmerpenguins)
		" );
	);
	
	MakePlot = Expr(
		R Submit(
			Eval Insert(
				"\[
				ggplot(data = penguins, aes(x = bill_length_mm, y = flipper_length_mm, colour = species)) +
				geom_point() +
				facet_wrap(. ~ island, nrow = 3)
			]\
			"
			);
		);
		
	);
	
	CapturePlot = Expr(
		JMP_plot = R Get Graphics( png );
		New Window( "Imported Plot", Picture Box( JMP_Plot ) );
	);
	
	RunClose = Expr(
		R Term(); //Close r connection
	);
);
LoadExprs;
InitR;
MakePlot;
CapturePlot;
RunClose;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If I try to call the R script directly, with the exact same R code, it fails with the error message "Get data for ''png" failed".&lt;/P&gt;&lt;P&gt;Here's the JSL script:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;LoadExprs = Expr(
	InitR = Expr(
		R Init();
	);

	RunR = Expr(
		R Submit File( "C:\Users\xxx\R_projects\JMP\R_JPM_integration_1.R" );
	);
	
	CapturePlot = Expr(
		JMP_plot = R Get Graphics( png );
		New Window( "Imported Plot", Picture Box( JMP_Plot ) );
	);
		
	RunClose = Expr(
		R Term(); //Close r connection
	);
);
LoadExprs;
InitR;
RunR;
CapturePlot;
RunClose;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This simplified JSL script, my first attempt, also fails with the same error code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;R Init();
R Submit File( "C:\Users\xxx\R_projects\JMP\R_JPM_integration_1.R" );
R Get Graphics( png );
R Term();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And here's the simple R-script I use for this test:&lt;/P&gt;&lt;PRE&gt;library(dplyr)
library(ggplot2)
library(palmerpenguins)

ggplot(data = penguins, aes(x = bill_length_mm, y = flipper_length_mm, colour = species)) +
  geom_point() +
  facet_wrap(. ~ island, nrow = 3)&lt;/PRE&gt;&lt;P&gt;Which is identical to the R code in the first script.&lt;/P&gt;&lt;P&gt;Is there a problem with the R Submit File call? What am I missing?&lt;/P&gt;&lt;P&gt;I would prefer to use &lt;FONT face="courier new,courier"&gt;R Submit File&lt;/FONT&gt; as it saves typing work.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:44:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-integration-issue-with-R-Submit-File/m-p/588025#M79318</guid>
      <dc:creator>paul_vanoppen</dc:creator>
      <dc:date>2023-06-08T16:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: R integration, issue with R Submit File</title>
      <link>https://community.jmp.com/t5/Discussions/R-integration-issue-with-R-Submit-File/m-p/588167#M79322</link>
      <description>&lt;P&gt;I ran your code under 16.2 and 17.0 running on Windows 10 64bit and got the&amp;nbsp;&lt;SPAN&gt;"Get data for ''png" failed". when running under JMP.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 05:17:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-integration-issue-with-R-Submit-File/m-p/588167#M79322</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-01-10T05:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: R integration, issue with R Submit File</title>
      <link>https://community.jmp.com/t5/Discussions/R-integration-issue-with-R-Submit-File/m-p/588363#M79334</link>
      <description>&lt;P&gt;I think when using R Submit File the plot is not written to the console (I could be wrong, I haven't dug in enough to be sure).&amp;nbsp; &amp;nbsp;I have gotten around this by reading the R file as text into JMP and then submitting it using R Submit.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 13:33:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-integration-issue-with-R-Submit-File/m-p/588363#M79334</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2023-01-10T13:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: R integration, issue with R Submit File</title>
      <link>https://community.jmp.com/t5/Discussions/R-integration-issue-with-R-Submit-File/m-p/588669#M79362</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Indeed, &lt;FONT face="courier new,courier"&gt;R Submit&lt;/FONT&gt; works just fine, see code below.&lt;/P&gt;&lt;P&gt;Still, I would like to determine how to make &lt;FONT face="courier new,courier"&gt;R Submit File&lt;/FONT&gt; work as it prevents having to copy (possibly large) R scripts.&lt;/P&gt;&lt;P&gt;Your assessment of why &lt;FONT face="courier new,courier"&gt;R Submit File&lt;/FONT&gt; does not work sounds plausible but would require an SAS/JMP expert to confirm.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;LoadExprs = Expr(
	InitR = Expr(
		R Init();
	);

	RunR = Expr(
		R Submit ( "
		   library(dplyr)
		   library(ggplot2)
		   library(palmerpenguins)

		   ggplot(data = penguins, aes(x = bill_length_mm, y = flipper_length_mm, colour = species)) +
			  geom_point() +
			  facet_wrap(. ~ island, nrow = 3)
		" );
	);
	
	CapturePlot = Expr(
		JMP_plot = R Get Graphics( png );
		New Window( "Imported Plot", Picture Box( JMP_Plot ) );
	);
		
	RunClose = Expr(
		R Term(); //Close r connection
	);
);
LoadExprs;
InitR;
RunR;
CapturePlot;
RunClose;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 00:31:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-integration-issue-with-R-Submit-File/m-p/588669#M79362</guid>
      <dc:creator>paul_vanoppen</dc:creator>
      <dc:date>2023-01-11T00:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: R integration, issue with R Submit File</title>
      <link>https://community.jmp.com/t5/Discussions/R-integration-issue-with-R-Submit-File/m-p/588684#M79365</link>
      <description>&lt;P&gt;I found a workaround by forcing R to open a graphics window and explicitly plot the graph to that window:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;library(dplyr)
library(ggplot2)
library(palmerpenguins)

&lt;FONT color="#FF0000"&gt;windows(800,600)&lt;/FONT&gt;
p &amp;lt;- ggplot(data = penguins, aes(x = bill_length_mm, y = flipper_length_mm, colour = species)) +
  geom_point() +
  facet_wrap(. ~ island, nrow = 3)
&lt;FONT color="#FF0000"&gt;plot(p)&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;I now need to worry about plot size but that's acceptable. Here's a screenshot of the script with the JMP graphics window:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="paul_vanoppen_1-1673398567643.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48969i587B4FB348D747F8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="paul_vanoppen_1-1673398567643.png" alt="paul_vanoppen_1-1673398567643.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 00:56:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-integration-issue-with-R-Submit-File/m-p/588684#M79365</guid>
      <dc:creator>paul_vanoppen</dc:creator>
      <dc:date>2023-01-11T00:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: R integration, issue with R Submit File</title>
      <link>https://community.jmp.com/t5/Discussions/R-integration-issue-with-R-Submit-File/m-p/588685#M79366</link>
      <description>&lt;P&gt;And I do not need the &lt;FONT face="courier new,courier"&gt;windows()&lt;/FONT&gt; function call either. Just explicitly plotting by calling the &lt;FONT face="courier new,courier"&gt;plot&lt;/FONT&gt; function is sufficient!&lt;/P&gt;&lt;P&gt;I did find that the JMP error message (&lt;FONT face="courier new,courier"&gt;"Get data for "png" failed"&lt;/FONT&gt;) disappears once I use the &lt;FONT face="courier new,courier"&gt;windows&lt;/FONT&gt; function call in R. I just end up with an empty window as nothing is explicitly plotted to it.&lt;/P&gt;&lt;P&gt;The code below works fine in conjunction with the JSL scipt using &lt;FONT face="courier new,courier"&gt;R submit File&lt;/FONT&gt;.&lt;/P&gt;&lt;PRE&gt;library(dplyr)
library(ggplot2)
library(palmerpenguins)

p &amp;lt;- ggplot(data = penguins, aes(x = bill_length_mm, y = flipper_length_mm, colour = species)) +
  geom_point() +
  facet_wrap(. ~ island, nrow = 3)
&lt;FONT color="#FF0000"&gt;plot(p)&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 01:15:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-integration-issue-with-R-Submit-File/m-p/588685#M79366</guid>
      <dc:creator>paul_vanoppen</dc:creator>
      <dc:date>2023-01-11T01:15:35Z</dc:date>
    </item>
  </channel>
</rss>

