当前位置: 首页>>代码示例>>Java>>正文


Java Rengine.eval方法代码示例

本文整理汇总了Java中org.rosuda.JRI.Rengine.eval方法的典型用法代码示例。如果您正苦于以下问题:Java Rengine.eval方法的具体用法?Java Rengine.eval怎么用?Java Rengine.eval使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.rosuda.JRI.Rengine的用法示例。


在下文中一共展示了Rengine.eval方法的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\")");
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:27,代码来源:rBoxplot.java

示例2: 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 + "\")");

	}
 
开发者ID:osimloeff,项目名称:Integrating-PI-System-with-R-White-Paper,代码行数:19,代码来源:Application.java

示例3: getOneDisabled

import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
private static void getOneDisabled(Rengine re, String featureType, String featureName, String collectionName){
	// If optional features
	if(featureType.equals("Docker") || featureType.equals("hibernateCache")
			|| featureType.equals("clusteredHttpSession") || featureType.equals("websocket")
			|| featureType.equals("searchEngine") || featureType.equals("enableSocialSignIn") 
			|| featureType.equals("useSass") || featureType.equals("enableTranslation"))
	{
		re.eval(String.format("%sOneDisabled <- data[grep(\"no|false|ND\", data$%s),]", collectionName, featureType));
	} else{
		re.eval(String.format("%sOneDisabled <- data[-grep(\"%s\", data$%s),]", collectionName, featureName, featureType));
	}
	
	
	re.eval(String.format("max%sEnabledFeatures <- as.numeric(as.character((data.frame(table(%sOneDisabled$nbFeatures))[nrow(data.frame(table(%sOneDisabled$nbFeatures))),1])))", collectionName, collectionName, collectionName));
	
	re.eval(String.format("%sOneDisabled <- %sOneDisabled[grep(max%sEnabledFeatures, %sOneDisabled$nbFeatures),]", collectionName, collectionName, collectionName, collectionName));
	
	re.eval(String.format("firstOne%sOneDisabled <- %sOneDisabled[1,]", collectionName, collectionName));
	
	for(int i=0; i<NUMBER_OF_RANDOMS; i++)
		re.eval(String.format("random%sOneDisabled%d <- %sOneDisabled[sample(nrow(%sOneDisabled),1),]", collectionName, i, collectionName, collectionName));
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:23,代码来源:Sampling.java

示例4: 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()");
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:20,代码来源:rBoxplot.java

示例5: 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()");
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:21,代码来源:rBoxplot.java

示例6: 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()");
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:25,代码来源:rBoxplot.java

示例7: createBoxplotCucumeberDatabase

import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
public static void createBoxplotCucumeberDatabase(Rengine re) {
	// Read CSV.
	readCSV(re, "jhipster.csv","data");
	readCSV(re, "cucumber.csv","data2");
	
	re.eval("mergeData = merge(data, data2)");
	
	// Create Boxplot + Save jpg
	re.eval("jpeg('boxplotCucumberDB.jpg')");
	
	re.eval("mergeData <- mergeData[- grep(\"ND\", mergeData$getCurrentUserLogin),]");

	//cast numerical getCurrentUserLogin
	re.eval("mergeData$getCurrentUserLogin <- as.numeric(as.character(mergeData$getCurrentUserLogin))");

	re.eval("boxplot(mergeData$getCurrentUserLogin~mergeData$prodDatabaseType, ylab='seconds'"
			//+ ",main='Boxplot Distribution:Cucumber Database'"
			+ ")");

	re.eval("dev.off()");
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:22,代码来源:rBoxplot.java

示例8: 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()");
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:23,代码来源:rBoxplot.java

示例9: 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()");

}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:39,代码来源:rBoxplot.java

示例10: 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()");
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:24,代码来源:rBoxplot.java

示例11: createPieChartBuildResultByBuildTool

import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
public static void createPieChartBuildResultByBuildTool(Rengine re){
	readCSV(re, "jhipster.csv","data");
	// drop NotDocker
	re.eval("data <- data[- grep(\"false\", data$Docker),]");
	re.eval("dataBuildToolBuildResult <- data.frame(table(data$buildTool, data$Build))");
	
	re.eval("buildOK <- dataBuildToolBuildResult[- grep(\"KO\", dataBuildToolBuildResult$Var2),]");
	re.eval("buildKO <- dataBuildToolBuildResult[- grep(\"OK\", dataBuildToolBuildResult$Var2),]");
	
	re.eval("buildOK <- as.vector(buildOK$Freq)");
	re.eval("buildKO <- as.vector(buildKO$Freq)");
	
	re.eval("labels <- c(\"Gradle\", \"Maven\")");
	
	re.eval("jpeg('buildOKPie.jpeg')");
	re.eval("pie(buildOK, labels = labels, main=\"Proportion of build success by build tool\")");
	re.eval("dev.off()");
	
	re.eval("jpeg('buildKOPie.jpeg')");
	re.eval("pie(buildKO, labels = labels"
			//+ ", main=\"Proportion of build failed by build tool\""
			+ ")");
	re.eval("dev.off()");
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:25,代码来源:rBoxplot.java

示例12: createBalloonPlot

import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
/**
 * Draw a balloon plot and generate a png file of it.
 * The plot concerns ApplicationType and ProductionDatabase.
 * 
 * @param re Rengine to execute r commands and get feedback.
 */
public static void createBalloonPlot(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$prodDatabaseType))");
	//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(\"Application Type\") + "
       						+ "ylab(\"Database\")");
       re.eval("ggsave(\"ggplot.jpg\")");
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:27,代码来源:rBoxplot.java

示例13: createBoxplotTimeGeneration

import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
public static void createBoxplotTimeGeneration(Rengine re) {
	// Read CSV.
	readCSV(re, "jhipster.csv","data");
	// Create Boxplot + Save jpg
	re.eval("jpeg('boxplotTimeToGenerate.jpg')");
	// drop doublon Docker
	re.eval("data <- data[- grep(\"true\", data$Docker),]");

	re.eval("boxplot(data$TimeToGenerate~data$applicationType, ylab='Time To Generate(secs)', xlab='Applications Type')");
			//+ "main='Boxplot Distribution:Time Generation of different JHipster apps')");

	re.eval("dev.off()");
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:14,代码来源:rBoxplot.java

示例14: run

import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
public void run() {
  	
  	REngineManager rengineManager = REngineManager.getInstance();
  	Rengine re = rengineManager.getREngine();	

try {						
	
	REXP RarResiduals;
	REXP RarPreds;
	re.assign("valseries", tSeries);
				
	re.eval("valseries.ar=ar.mle(valseries, aic=FALSE, order.max="+ arOrder + ")");
	RarResiduals=re.eval("valseries.ar$resid["+initialOffset + ":length(valseries)]");
	RarResiduals=re.eval("valseries.ar$resid["+initialOffset + ":length(valseries)]");
	
	this.arResiduals = RarResiduals.asDoubleArray();
	re.eval("valpred=predict(valseries.ar,n.ahead="+predStep+")");
	RarPreds=re.eval("valpred$pred");
	
	this.arPreds = RarPreds.asDoubleArray(); 
	
} catch (Exception e) {
	System.out.println("EX:"+e);
	e.printStackTrace();
	rengineManager.endEngine();
} 
	
  }
 
开发者ID:LSIR,项目名称:gsn,代码行数:29,代码来源:ARModel.java

示例15: Start

import org.rosuda.JRI.Rengine; //导入方法依赖的package包/类
public static void Start(Rengine re)
{
	System.out.print("ImportingObjs");
	

	String RCodeString ="";
       //R string vector
       RCodeString = "mycharvector<-c(\"hello\",\"bye\",\"OSIsoft\")";
       System.out.println("\nR Code: " + RCodeString);
       REXP Rstringvector = re.eval(RCodeString);
       String[] myStringArray = Rstringvector.asStringArray();
       System.out.println("\nmyStringArray: ");
       int i = 1;
       for(String myString : myStringArray)
       {
       	System.out.println(i + " value: " + myString);
           i++;
       }
       

       //R int vector
       RCodeString = "myintvector<-1:10";
       System.out.println("\nR Code: " + RCodeString);
       REXP Rintvector = re.eval(RCodeString);
       int[] myIntegerArray = Rintvector.asIntArray();
       System.out.println("\nInteger Vector: ");
       i = 1;
       for(int myInteger : myIntegerArray)
       {
           System.out.println(i + " value=" + myInteger);
           i++;
       }


       //R real vector
       RCodeString = "myrealvector<-rnorm(5, 0, 1)";
       System.out.println("\nR Code: " + RCodeString);
       REXP Rrealvector= re.eval(RCodeString);
       double[] myDoubleArray = Rrealvector.asDoubleArray();
       System.out.println("\nNumeric Vector: ");
       i = 1;
       for(double myNumeric : myDoubleArray)
       {
           System.out.println(i + " value=" + myNumeric);
           i++;
       }


       //R Boolean
       RCodeString = "mybool<-c(FALSE)";
       System.out.println("\nR Code: " + RCodeString);
       RBool myBool = re.eval(RCodeString ).asBool();
       System.out.println(i + " value=" + myBool.toString());

}
 
开发者ID:osimloeff,项目名称:Integrating-PI-System-with-R-White-Paper,代码行数:56,代码来源:ImportingObjs.java


注:本文中的org.rosuda.JRI.Rengine.eval方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。