Rプログラミングを使用してFFTを分析しています。今、私は Java Web アプリケーション/Java サーブレットを作成し、R を呼び出して Rcaller/Rcode を使用したいと考えています。Java アプリケーションでの Rcode の呼び出しに関するリファレンスがあります。http://code.google.com/p/rcaller/wiki/Examples
A.csv
time Amplitude
1 0.00000 -0.021
2 0.00001 -0.024
3 0.00003 -0.013
4 0.00004 -0.023
5 0.00005 0.019
6 0.00007 - 0.002
7 0.00008 -0.013
次に、このファイルをアップロードし、分析 FFT とプロットに R コードを使用します。助けていただければ幸いです。前もってありがとう、マリア
2 に答える
0
このコードを実行すると実行されますが、何も表示されませんでした!!!!!!!!
package test2;
import java.io.File;
import java.io.IOException;
import java.util.Random;
import javax.swing.ImageIcon;
import rcaller.RCaller;
import rcaller.RCode;
import rcaller.exception.RCallerExecutionException;
import rcaller.exception.RCallerParseException;
public class Test2 {
public static void main(String[] args) {
Test2 test2=new Test2();
}
private int span;
@SuppressWarnings("empty-statement")
public void test2()throws IOException{
try {
RCaller caller = new RCaller();
caller.setRscriptExecutable("C:\\Program Files\\R\\R-3.0.3\\bin\\Rscript.exe");
RCode code = new RCode();
code.addRCode("dat<-read.csv(\"NetBeansProjects\"test2\"A.csv\",header=T,sep=\",\"");
File file=code.startPlot();
code.addRCode("plot.ts(dat$Amplitude)");
code.endPlot();
caller.setRCode(code);
caller.runOnly();
ImageIcon i=code.getPlot(file);
code.showPlot(file);
} catch (RCallerExecutionException | RCallerParseException e) {
System.out.println(e.toString());
}
}
}
于 2014-04-24T05:25:18.977 に答える