<?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 interface in JMP in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485772#M72961</link>
    <description>&lt;P&gt;I suggest that you contact JMP Technical Support (&lt;A href="mailto:support@jmp.com" target="_blank"&gt;support@jmp.com&lt;/A&gt;) for help with this problem.&lt;/P&gt;</description>
    <pubDate>Tue, 10 May 2022 16:18:25 GMT</pubDate>
    <dc:creator>Mark_Bailey</dc:creator>
    <dc:date>2022-05-10T16:18:25Z</dc:date>
    <item>
      <title>R interface in JMP</title>
      <link>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485185#M72925</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote a code in R that I want to run into JMP. Here is the code :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;R init();

//send data to R
R Send(dt);
R submit("
library(spatstat)
#creation fenetre
fenn&amp;lt;-owin(xrange=c(40,760), yrange=c(40,160), poly=NULL, mask=NULL, units=NULL)
ppp&amp;lt;-ppp(x=dt$XM,y=dt$YM,window=fenn)
print(quadratcount(ppp,nx=6,ny=3)

Q&amp;lt;-quadrat.test.ppp(ppp,nx=6,ny=3)

a&amp;lt;-cdf.test(ppp,'x')

D=0
if(a[[2]] &amp;amp; Q[[3]] &amp;lt; 0.1 ){
  D=0}else {D=1}
Distribution=as.data.frame(rep(c(D),nrow(dt)))

class(Distribution)
print(a)

");
R term();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then when I run it I got two issues:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Firstly I have an error from these lines :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;fenn&amp;lt;-owin(xrange=c(40,760), yrange=c(40,160), poly=NULL, mask=NULL, units=NULL)
ppp&amp;lt;-ppp(x=dt$XM,y=dt$YM,window=fenn)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which says :&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Error: Function boundingbox called with 2 unrecognised arguments&lt;BR /&gt;In addition: Warning message:&lt;BR /&gt;2 points were rejected as lying outside the specified window&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;In fact when I change 40 into 0 it works because all my points are in my window, but when I run the code on R the fact that all my points are not in the window is not an issue. And if I run the previous code in R it works. So I don't understand why I got a warning message in JMP but not in R.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second issue is when I want to export my data, JMP don't want to extract my data frame and I don't understand why. I use this code :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;ResidJMP = R Get(Distribution);
ResidJMP &amp;lt;&amp;lt; New Data View;
R term();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In fact I want to return a data table in JMP and after I want to use it as the main data table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:48:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485185#M72925</guid>
      <dc:creator>CheeseProgram</dc:creator>
      <dc:date>2023-06-10T23:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: R interface in JMP</title>
      <link>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485244#M72928</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a basic example,&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;R Init();   // Initiate R connection

dt = Open(“$SAMPLE_DATA/Big Class.jmp”,invisible);
R Send(dt);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the call of column should be done on the following way:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;R Submit("
print(dt['weight'])
	//b&amp;lt;-dt['weight']/dt['height']
");
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;instead of&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;R Submit("
print(dt$weight)
	//b&amp;lt;-dt['weight']/dt['height']
");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I think it should change the output of your first problem.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 15:29:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485244#M72928</guid>
      <dc:creator>flo_kussener</dc:creator>
      <dc:date>2022-05-09T15:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: R interface in JMP</title>
      <link>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485248#M72930</link>
      <description>&lt;P&gt;When I apply this to my data it says that the columns I used aren't numeric, then when I use as.numeric() function it says :&amp;nbsp;'list' object cannot be coerced to type 'double'. This problem doesn't appeared with the $ call. There are so many issues here unfortunately&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 15:52:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485248#M72930</guid>
      <dc:creator>CheeseProgram</dc:creator>
      <dc:date>2022-05-09T15:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: R interface in JMP</title>
      <link>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485274#M72932</link>
      <description>&lt;P&gt;You can use a JMP data table as a data frame in R. The R Send() function automatically converts one data structure into the other. Here is a simple example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

// make sure JMP can find the desired installed version of R
Set Environment Variable( "R_HOME", "C:\Program Files\R\R-4.1.3" );

// use regression example from JMP Sample Data Folder
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

// use standard linear model function with data frame
R Init( );
R Send( dt );
R Submit(
"fit &amp;lt;- lm( dt$weight~dt$height )
print( fit )"
);
R Term();

// examine results in Log&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I suspect that there is a problem with the R code (function arguments), or the nature of the variables in the data frame. After you make sure that your function call is correct, try printing the data table from R to see if everything transferred as expected.&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 16:26:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485274#M72932</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2022-05-09T16:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: R interface in JMP</title>
      <link>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485277#M72933</link>
      <description>&lt;P&gt;When I use this code on R&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;library(spatstat)
data&amp;lt;-read.("Results.csv")
#creation fenetre
fenn&amp;lt;-owin(xrange=c(40,760), yrange=c(40,160), poly=NULL, mask=NULL, units=NULL)
#creation point pattern
ppp&amp;lt;-ppp(x=data$XM,y=data$YM,window=fenn)
plot(ppp)
summary(ppp)

#test quadrat
quadratcount(ppp,nx=6,ny=3)
Q&amp;lt;-quadrat.test.ppp(ppp,nx=6,ny=3)
paste("Ma pvalue du quadrat test ", format(Q[[3]], scientific=TRUE, digits=3))

#test ks
a&amp;lt;-kstest(ppp,'x')

paste("Ma pvalue du KS test ", format(a[[2]], scientific=TRUE, digits=3))

D=character()
if(a[[2]] &amp;amp; Q[[3]] &amp;lt; 0.1 ){
  D="Distribution Non-Uniforme"}else {D="Distribution Uniforme"}
Distribution&amp;lt;-rep(c(D),length(XM))
dt&amp;lt;-cbind(dt,Distribution)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works good. In fact it works good in JMP if I use this window :&lt;/P&gt;&lt;PRE&gt;fenn&amp;lt;-owin(xrange=c(0,760), yrange=c(0,160), poly=NULL, mask=NULL, units=NULL)&lt;/PRE&gt;&lt;P&gt;Because all my (x,y) points are in the window, the problem comes out when I put the window I want. But in R there is no problem of window.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if there is a problem with the variables it shouldn't work with an other window and this is what I don't understand.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe there is something I don't understand in your comment but I don't find what could be the error. When I print it on JMP from R I have the good data frame. I'm lost for sure&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 16:44:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485277#M72933</guid>
      <dc:creator>CheeseProgram</dc:creator>
      <dc:date>2022-05-09T16:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: R interface in JMP</title>
      <link>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485298#M72934</link>
      <description>&lt;P&gt;I try to use R Submit File() function so I can use the exact same code. But I have the same error on the jmp code that I don't have in R. This is the error that I need resolve. I try so much things and also don't understand why it appears.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Error: Function boundingbox called with 2 unrecognised arguments&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 May 2022 17:11:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485298#M72934</guid>
      <dc:creator>CheeseProgram</dc:creator>
      <dc:date>2022-05-09T17:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: R interface in JMP</title>
      <link>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485299#M72935</link>
      <description>&lt;P&gt;Did you try my simple example? Does it work? What do you see in the JMP Log?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you try sending a JMP data table to R and printing it in R? Does that data frame match the data table?&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 17:12:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485299#M72935</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2022-05-09T17:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: R interface in JMP</title>
      <link>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485305#M72936</link>
      <description>&lt;P&gt;Your example works I had this in the log :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CheeseProgram_1-1652116858620.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/42327iD961E805EA5D6C67/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CheeseProgram_1-1652116858620.png" alt="CheeseProgram_1-1652116858620.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For your second question I'm not sure I'm understanding it well. But I try to send my JMP data table to R with send() command and then print it in the log. For your example it looks like this :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CheeseProgram_2-1652117089755.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/42328i8575A61024A9E3D1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CheeseProgram_2-1652117089755.png" alt="CheeseProgram_2-1652117089755.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In my example i got this in the log :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CheeseProgram_3-1652117341975.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/42329i9B00B80F96E65CF3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CheeseProgram_3-1652117341975.png" alt="CheeseProgram_3-1652117341975.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and my table look like this :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CheeseProgram_4-1652117369383.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/42330iE98AE2B8A1E41F46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CheeseProgram_4-1652117369383.png" alt="CheeseProgram_4-1652117369383.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>Mon, 09 May 2022 17:29:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485305#M72936</guid>
      <dc:creator>CheeseProgram</dc:creator>
      <dc:date>2022-05-09T17:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: R interface in JMP</title>
      <link>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485595#M72950</link>
      <description>&lt;P&gt;Now my main problem is to export my data frame from R. I have the same error with your example than with my data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Erreur&amp;nbsp;: Error in if (is.na(datam)) { : the condition has length &amp;gt; 1
Unexpected errors occurred while attempting to transfer the data.&lt;/PRE&gt;&lt;P&gt;I check that my R get() is on a data.frame. Here is my code :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Treat=Open( "C:\Users\GROUSD01\Desktop\CréationcodeMPPT\Results 4.jmp" );


R init();

//send data to R
R Send(Treat);
R submit("library(spatstat)
round(Treat$XM)
round(Treat$YM)
XM&amp;lt;-Treat$XM
YM&amp;lt;-Treat$YM
test&amp;lt;-as.data.frame(cbind(XM,YM))
test2&amp;lt;-data.frame()
for (i in 1:nrow(test)){
  if(test[i,2]&amp;gt;39){
    test2&amp;lt;-rbind(test2,test[i,1:2])}}


fenn&amp;lt;-owin(xrange=c(40,760), yrange=c(40,160), poly=NULL, mask=NULL, units=NULL)
#creation point pattern
ppp&amp;lt;-ppp(x=test2$XM,y=test2$YM,window=fenn)
print(ppp)
plot(quadratcount(ppp,nx=6,ny=3))
Q&amp;lt;-quadrat.test.ppp(ppp,nx=6,ny=3)
print(Q)

a&amp;lt;-cdf.test(ppp,'x')

paste('Ma pvalue du KS test ', format(a[[2]], digits=3))

D=character()
if(a[[2]] &amp;amp; Q[[3]] &amp;lt; 0.1 ){
  D='Distribution Non-Uniforme'}else {D='Distribution Uniforme'}
Distribution&amp;lt;-(rep(c(D),length(Treat$XM)))
Treat&amp;lt;-cbind(Treat,Distribution)

");
R Get(Treat)&amp;lt;&amp;lt;New Data View
R term();&lt;/PRE&gt;&lt;P&gt;But I tried a lot of different things for the same results&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 10:10:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485595#M72950</guid>
      <dc:creator>CheeseProgram</dc:creator>
      <dc:date>2022-05-10T10:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: R interface in JMP</title>
      <link>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485772#M72961</link>
      <description>&lt;P&gt;I suggest that you contact JMP Technical Support (&lt;A href="mailto:support@jmp.com" target="_blank"&gt;support@jmp.com&lt;/A&gt;) for help with this problem.&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 16:18:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/485772#M72961</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2022-05-10T16:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: R interface in JMP</title>
      <link>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/549490#M76592</link>
      <description>&lt;P&gt;Was there a solution to the error?&lt;/P&gt;&lt;PRE&gt;Error in if (is.na(datam)) { : the condition has length &amp;gt; 1&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I have the same issue.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2022 18:30:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/R-interface-in-JMP/m-p/549490#M76592</guid>
      <dc:creator>CurseOfCapybara</dc:creator>
      <dc:date>2022-09-26T18:30:58Z</dc:date>
    </item>
  </channel>
</rss>

