[R] How do I use simple calls to java methods?

Hurr hill0093 at umn.edu
Tue Oct 22 02:31:47 CEST 2013


I need to learn how to set up two methods (java functions) so I can call them
from R.
Currently I just copy and paste R code into the R console. 
A little piece of the R code inside a loop is:
      linTm <- linTimOfCalStg(dta[i,timCol],tlev) 
      calCk <- calStgOfLinTim(linTm,tlev) 
      if(calCk!=dta[i,timCol]) { 
        print(c(i,dta[i,timCol],linTm,calCk),digits=20) 
        stop("incorrect time conversion") 
      } 
The two functions called have these first lines:
linTimOfCalStg <- function(calStg,tlev) and 
calStgOfLinTim <- function(linTm, tlev) 
which in java substitutes are: 
public final static double linTimOfCalqsStg(String calStg,int tlev)  and  
public final static String calqsStgOfLinTim(double linTm,int tlev) 
both in a java class called "CalqsLin.class" compiled from "CalqsLin.java".
The R code works.
The purpose of all this is to eliminate duplicate subroutines and 
their duplicate checking ln both languages.
There will be several other subroutines that I will also use in both
languages.
I can start by putting everything into a single directory in Windows seven
to learn.
How do I make this substitution?




--
View this message in context: http://r.789695.n4.nabble.com/How-do-I-use-simple-calls-to-java-methods-tp4678753.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list