I have two comments that might help.
First of all, I showed how you can make sure that JMP finds R after you install it. Here is the JSL code for that purpose. Does the path that I use match the path that you should use? Please make sure that the location is correct.
// make sure JMP can find the desired installed version of R
Set Environment Variable( "R_HOME", "C:\Program Files\R\R-4.1.3" );
Your R script refers to a dta data frame, but that is a JMP data table that that you did not send. You sent JMP data columns as individual vectors to R instead. So you must either create the data frame in R from the vectors that you sent, or send the data table instead of the vectors and use it in R. JMP creates a data frame for R automatically, so the latter approach seems easier and more efficient. See my second example above.
Also, be sure to call this function at the end of your script:
R Term();