本文整理汇总了Java中org.rosuda.JRI.Rengine类的典型用法代码示例。如果您正苦于以下问题:Java Rengine类的具体用法?Java Rengine怎么用?Java Rengine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Rengine类属于org.rosuda.JRI包,在下文中一共展示了Rengine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBalloonPlotBugsFeatures
import org.rosuda.JRI.Rengine; //导入依赖的package包/类
/**
* Draw a balloon plot and generate a jpg file of it.
* The plot concerns KO build and features.
*
* @param re Rengine to execute r commands and get feedback.
*/
public static void createBalloonPlotBugsFeatures(Rengine re){
// Install packge (only necessary once)
//re.eval("install.packages(\"ggplot2\")");
// Retrieve data and extract ApplicationType and DatabaseColumn, grouped and counted
readCSV(re, "jhipster.csv","data");
re.eval("temp <- data.frame(table(data$applicationType, data$Build))");
//re.eval("print(names(temp))");
re.eval("names(temp)[names(temp)==\"Freq\"] <- \"Proportion\"");
//re.eval("print(temp)");
// Draw the balloonPlot
re.eval("library(ggplot2)");
re.eval("p <- ggplot(temp, aes(x=Var1, y=Var2, size=Proportion)) + "
+ "geom_point(shape=21, colour=\"black\", fill=\"cornsilk\") +"
+ "xlab(\"Build\") + "
+ "ylab(\"Features\")");
re.eval("ggsave(\"bugsFeatures.jpg\")");
}
示例2: rWriteConsole
import org.rosuda.JRI.Rengine; //导入依赖的package包/类
@Override
public synchronized void rWriteConsole(final Rengine rengine, final String text, final int oType) {
if (oType != 0) {
error = true;
errorMessage.append(text);
} else {
//might have been a simple warning message like loading package or so, since a normal message followed it
errorMessage.setLength(0);
}
if (text.endsWith("\n")) {
message.append(text);
if (Strings.isNotBlank(message)) {
if (error) {
IScriptTaskRunnerR.LOG.warn(String.valueOf(message).trim());
} else {
IScriptTaskRunnerR.LOG.debug(String.valueOf(message).trim());
}
}
message.setLength(0);
error = false;
} else {
message.append(text);
}
}
示例3: main
import org.rosuda.JRI.Rengine; //导入依赖的package包/类
public static void main(String[] args) {
System.out.println("Creating Rengine (with arguments)");
// If not started with --vanilla, funny things may happen in this R
// shell.
String[] Rargs = { "--vanilla" };
Rengine re = new Rengine(Rargs, false, null);
System.out.println("Rengine created, waiting for R");
// the engine creates R is a new thread, so we should wait until it's
// ready
if (!re.waitForR()) {
System.out.println("Cannot load R");
return;
}
ImportingObjs.Start(re);
ExportingObjs.Start(re);
re.end();
}
示例4: InicializeRNet
import org.rosuda.JRI.Rengine; //导入依赖的package包/类
private void InicializeRNet() {
System.out.println("Creating Rengine (with arguments)");
// If not started with --vanilla, funny things may happen in this R
// shell.
String[] Rargs = { "--vanilla" };
engine = new Rengine(Rargs, false, null);
// System.out.println("Rengine created, waiting for R");
// the engine creates R is a new thread, so we should wait until it's
// ready
if (!engine.waitForR()) {
System.out.println("Cannot load R");
return;
}
String rfilepath = "C:\\\\Program Files\\\\R\\\\R-3.3.1\\\\library\\\\Functions.R";
engine.eval("source(\"" + rfilepath + "\")");
}
示例5: main
import org.rosuda.JRI.Rengine; //导入依赖的package包/类
public static void main(String[] args) {
// just making sure we have the right version of everything
if (!Rengine.versionCheck()) {
System.err.println("** Version mismatch - Java files don't match library version.");
System.exit(1);
}
System.out.println("Creating Rengine (with arguments)");
Rengine re=new Rengine(args, false, new TextConsole());
System.out.println("Rengine created, waiting for R");
// the engine creates R is a new thread, so we should wait until it's ready
if (!re.waitForR()) {
System.out.println("Cannot load R");
return;
}
selectOneEnabled(re);
selectOneDisabled(re);
selectMostEnabledDisabled(re);
re.end();
System.out.println("end");
}
示例6: selectOneEnabled
import org.rosuda.JRI.Rengine; //导入依赖的package包/类
/**
* Computes for each optional feature the proportion of failure and bugs with a one-enabled sample.
*
* @param re
*/
private static void selectOneEnabled(Rengine re){
readCSV(re,"jhipster.csv","data");
for(String feat : OPTIONALS){
selectEnabled(re,feat,feat+"OneEnabled","data");
for (String feat2 : OPTIONALS){
if (!feat2.equals(feat)){
selectDisabled(re, feat2, feat+"OneEnabled", feat+"OneEnabled");
}
}
// find proportion of failure
extractFailureProportion(re,feat+"OneEnabled");
// find proportion of bugs
extractBugProportion(re,feat+"OneEnabled");
}
}
示例7: createCircleTypeApp
import org.rosuda.JRI.Rengine; //导入依赖的package包/类
public static void createCircleTypeApp(Rengine re) {
// Read CSV.
readCSV(re, "jhipster.csv","data");
// Create Circle + Save jpg
re.eval("jpeg('typeApp.jpg')");
//extract number of types in table
re.eval("type <- table(data$applicationType)");
//data vecteur
re.eval("as.numeric(type)");
// WARNING VERIFY GOOD NUMBER WITH GOOD TYPE -> alphabetic order
re.eval("vecteur <- c(type[1],type[2],type[3],type[4])");
//names
re.eval("A <- gl(5,1,5,labels=c(\"Gateway\",\"Microservice\",\"Monolithic\",\"Uaa\"))");
re.eval("names(vecteur) <- levels(A)");
re.eval("pie(vecteur/100"
//+ ",main=\"Types d'application générées\""
+ ")");
re.eval("dev.off()");
}
示例8: createBoxplotTimeCompile
import org.rosuda.JRI.Rengine; //导入依赖的package包/类
public static void createBoxplotTimeCompile(Rengine re) {
// Read CSV.
readCSV(re, "jhipster.csv","data");
// Create Boxplot + Save jpg
re.eval("jpeg('boxplotTimeToCompile.jpg')");
// drop doublon Docker
re.eval("data <- data[- grep(\"true\", data$Docker),]");
// drop KO timeToCompile
re.eval("data <- data[- grep(\"KO\", data$TimeToCompile),]");
//cast numerical
re.eval("data$TimeToCompile <- as.numeric(as.character(data$TimeToCompile))");
//System.out.println(re.eval("boxplot(data$TimeToGenerate.secs.)"));
re.eval("boxplot(data$TimeToCompile~data$applicationType, ylab='Time To Compile(secs)'"
//+ ","
//+ "main='Boxplot Distribution:Time Compilation of different JHipster apps'"
+ ")");
re.eval("dev.off()");
}
示例9: createBoxplotTimeBuildWithoutDockerApp
import org.rosuda.JRI.Rengine; //导入依赖的package包/类
public static void createBoxplotTimeBuildWithoutDockerApp(Rengine re) {
// Read CSV.
readCSV(re, "jhipster.csv","data");
// Create Boxplot + Save jpg
re.eval("jpeg('boxplotTimeToBuildWithoutDocker.jpg')");
// drop Docker
re.eval("data <- data[- grep(\"true\", data$Docker),]");
// drop ND timeToBuild
//re.eval("data <- data[- grep(\"ND\", data$TimeToBuild),]");
// only OK BUILD !!
re.eval("data <- data[- grep(\"KO\", data$Build),]");
//cast numerical
re.eval("data$TimeToBuild <- as.numeric(as.character(data$TimeToBuild))");
re.eval("boxplot(data$TimeToBuild~data$applicationType, ylab='Time To Build(secs)'"
//+ ",main='Boxplot Distribution:Time to build without Docker'
+")");
re.eval("dev.off()");
}
示例10: createBoxplotTimeBuildWithDockerApp
import org.rosuda.JRI.Rengine; //导入依赖的package包/类
public static void createBoxplotTimeBuildWithDockerApp(Rengine re) {
// Read CSV.
readCSV(re, "jhipster.csv","data");
// Create Boxplot + Save jpg
re.eval("jpeg('boxplotTimeToBuildWithDocker.jpg')");
// drop NotDocker
re.eval("data <- data[- grep(\"false\", data$Docker),]");
// drop ND Time To build
//re.eval("data <- data[- grep(\"ND\", data$TimeToBuild),]");
// drop KO Time To build Docker Package
//re.eval("data <- data[- grep(\"ND\", data$TimeToBuildDockerPackage),]");
// only OK BUILD !!
re.eval("data <- data[- grep(\"KO\", data$Build),]");
//cast numerical TimeToBuild and TimeToBuildDockerPackage
re.eval("data$TimeToBuild <- as.numeric(as.character(data$TimeToBuild))");
re.eval("data$TimeToBuildDockerPackage <- as.numeric(as.character(data$TimeToBuildDockerPackage))");
//Add TimeToBuildDockerPackage to TimeToBuild
re.eval("data$TimeToBuildTotal <- data$TimeToBuildDockerPackage + data$TimeToBuild");
re.eval("boxplot(data$TimeToBuildTotal~data$applicationType, ylab='Time To Build(secs)'"
//+ ",main='Boxplot Distribution:Time to build with Docker'"
+ ")");
re.eval("dev.off()");
}
示例11: createBoxplotTimeBuildWithoutDockerBuildTool
import org.rosuda.JRI.Rengine; //导入依赖的package包/类
public static void createBoxplotTimeBuildWithoutDockerBuildTool(Rengine re) {
// Read CSV.
readCSV(re, "jhipster.csv","data");
// Create Boxplot + Save jpg
re.eval("jpeg('boxplotTimeToBuildWithoutDockerBuildTool.jpg')");
// drop Docker
re.eval("data <- data[- grep(\"true\", data$Docker),]");
// drop ND timeToBuil
//re.eval("data <- data[- grep(\"ND\", data$TimeToBuild),]");
// only OK BUILD !!
re.eval("data <- data[- grep(\"KO\", data$Build),]");
//cast numerical
re.eval("data$TimeToBuild <- as.numeric(as.character(data$TimeToBuild))");
re.eval("boxplot(data$TimeToBuild~data$buildTool, ylab='Time To Build(secs)'"
//+ ",main='Boxplot Distribution:Time to build without Docker/buildTool'"
+ ")");
re.eval("dev.off()");
}
示例12: createBoxplotTimeBuildWithDockerBuildTool
import org.rosuda.JRI.Rengine; //导入依赖的package包/类
public static void createBoxplotTimeBuildWithDockerBuildTool(Rengine re) {
// Read CSV.
readCSV(re, "jhipster.csv","data");
// Create Boxplot + Save jpg
re.eval("jpeg('boxplotTimeToBuildWithDockerBuildTool.jpg')");
// drop NotDocker
re.eval("data <- data[- grep(\"false\", data$Docker),]");
// drop ND timeToBuild
//re.eval("data <- data[- grep(\"ND\", data$TimeToBuild),]");
// only OK BUILD !!
re.eval("data <- data[- grep(\"KO\", data$Build),]");
//cast numerical TimeToBuild and TimeToBuildDockerPackage
re.eval("data$TimeToBuild <- as.numeric(as.character(data$TimeToBuild))");
re.eval("data$TimeToBuildDockerPackage <- as.numeric(as.character(data$TimeToBuildDockerPackage))");
//Add TimeToBuildDockerPackage to TimeToBuild
re.eval("data$TimeToBuildTotal <- data$TimeToBuildDockerPackage + data$TimeToBuild");
re.eval("boxplot(data$TimeToBuildTotal~data$buildTool, ylab='Time To Build(secs)'"
//+ ",main='Boxplot Distribution:Time to build with Docker/buildTool'"
+ ")");
re.eval("dev.off()");
}
示例13: createBoxplotCoverage
import org.rosuda.JRI.Rengine; //导入依赖的package包/类
public static void createBoxplotCoverage(Rengine re) {
// Read CSV.
readCSV(re, "jhipster.csv","dataJava");
readCSV(re, "jhipster.csv","dataJS");
re.eval("dataJava <- dataJava[- grep(\"ND\", dataJava$CoverageInstructions),]");
//re.eval("dataJava <- dataJava[- grep(\"X\", dataJava$CoverageInstructions),]");
re.eval("dataJS <- dataJS[- grep(\"ND\", dataJS$JSStatementsCoverage),]");
//re.eval("dataJS <- dataJS[- grep(\"X\", dataJS$JSStatementsCoverage),]");
//remove % char
re.eval("dataJS$JSStatementsCoverage <- as.data.frame(sapply(dataJS$JSStatementsCoverage,gsub,pattern=\"%\",replacement=\"\"))");
re.eval("dataJS$JSStatementsCoverage <- unlist(dataJS$JSStatementsCoverage)");
re.eval("dataJS$JSBranchesCoverage <- as.data.frame(sapply(dataJS$JSBranchesCoverage,gsub,pattern=\"%\",replacement=\"\"))");
re.eval("dataJS$JSBranchesCoverage <- unlist(dataJS$JSBranchesCoverage)");
//set numerical
re.eval("dataJava$CoverageInstructions <- as.numeric(as.character(dataJava$CoverageInstructions))");
re.eval("dataJava$CoverageBranches <- as.numeric(as.character(dataJava$CoverageBranches))");
re.eval("dataJS$JSStatementsCoverage <- as.numeric(as.character(dataJS$JSStatementsCoverage))");
re.eval("dataJS$JSBranchesCoverage <- as.numeric(as.character(dataJS$JSBranchesCoverage))");
re.eval("jpeg('boxplotJAVACoverage.jpg')");
//System.out.println(re.eval("boxplot(data$CoverageInstructions...)"));
re.eval("lmts <- range(dataJava$CoverageInstructions,dataJava$CoverageBranches,dataJS$JSStatementsCoverage,dataJS$JSBranchesCoverage)");
re.eval("par(mfrow = c(2, 2))");
re.eval("boxplot(dataJava$CoverageInstructions,ylim=lmts, xlab='CoverageInstruction(%)')");
re.eval("boxplot(dataJava$CoverageBranches,ylim=lmts, xlab='CoverageBranches(%)')");
re.eval("boxplot(dataJS$JSStatementsCoverage,ylim=lmts, xlab='CoverageJSStatements(%)')");
re.eval("boxplot(dataJS$JSBranchesCoverage,ylim=lmts, xlab='CoverageJSBranches(%)')");
//re.eval("title(\"Boxplot Distribution of JAVA Coverage JHipster Tests\", outer=TRUE)");
//re.eval("(annotate(\"Boxplot Distribution of JAVA Coverage JHipster Tests\", side = 3, line = -21, outer = TRUE)");
re.eval("dev.off()");
}
示例14: createBoxplotImageDockerApplications
import org.rosuda.JRI.Rengine; //导入依赖的package包/类
public static void createBoxplotImageDockerApplications(Rengine re) {
// Read CSV.
readCSV(re, "jhipster.csv","data");
// Create Boxplot + Save jpg
re.eval("jpeg('boxplotImageDockerApps.jpg')");
// drop NotDocker
re.eval("data <- data[- grep(\"false\", data$Docker),]");
// drop ND imageDocker
re.eval("data <- data[- grep(\"ND\", data$ImageDocker),]");
//remove MB
re.eval("data$ImageDocker <- as.data.frame(sapply(data$ImageDocker,gsub,pattern=\" MB\",replacement=\"\"))");
//rempove quotes
re.eval("data$ImageDocker <- as.data.frame(sapply(data$ImageDocker, function(x) gsub(\"\\\"\", \"\", x)))");
re.eval("data$ImageDocker <- unlist(data$ImageDocker)");
//cast numerical TimeToBuild and TimeToBuildDockerPackage
re.eval("data$ImageDocker <- as.numeric(as.character(data$ImageDocker))");
re.eval("boxplot(data$ImageDocker~data$applicationType, ylab='ImageDocker(MB)'"
//+ ",main='Boxplot Distribution:Image Docker'"
+ ")");
re.eval("dev.off()");
}
示例15: createBoxplotImageDockerDB
import org.rosuda.JRI.Rengine; //导入依赖的package包/类
public static void createBoxplotImageDockerDB(Rengine re) {
// Read CSV.
readCSV(re, "jhipster.csv","data");
// Create Boxplot + Save jpg
re.eval("jpeg('boxplotImageDockerDB.jpg')");
// drop NotDocker
re.eval("data <- data[- grep(\"false\", data$Docker),]");
// drop ND imageDocker
re.eval("data <- data[- grep(\"ND\", data$ImageDocker),]");
//remove MB
re.eval("data$ImageDocker <- as.data.frame(sapply(data$ImageDocker,gsub,pattern=\" MB\",replacement=\"\"))");
//rempove quotes
re.eval("data$ImageDocker <- as.data.frame(sapply(data$ImageDocker, function(x) gsub(\"\\\"\", \"\", x)))");
re.eval("data$ImageDocker <- unlist(data$ImageDocker)");
//cast numerical TimeToBuild and TimeToBuildDockerPackage
re.eval("data$ImageDocker <- as.numeric(as.character(data$ImageDocker))");
re.eval("boxplot(data$ImageDocker~data$prodDatabaseType, ylab='ImageDocker(MB)'"
//+ ",main='Boxplot Distribution:Image Docker'"
+ ")");
re.eval("dev.off()");
}