本文整理汇总了Java中org.rosuda.REngine.Rserve.RConnection.voidEval方法的典型用法代码示例。如果您正苦于以下问题:Java RConnection.voidEval方法的具体用法?Java RConnection.voidEval怎么用?Java RConnection.voidEval使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.rosuda.REngine.Rserve.RConnection
的用法示例。
在下文中一共展示了RConnection.voidEval方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeFile
import org.rosuda.REngine.Rserve.RConnection; //导入方法依赖的package包/类
/**
* Remove a file on the RServer.
* @param filename File to remove
*/
public void removeFile(final String filename) throws REngineException {
// Test if the file exists
final RConnection c = getRConnection();
try {
REXP exists = c.eval("file.exists(\"" + filename + "\")");
if (exists.asInteger() == 1) {
c.voidEval("file.remove(\"" + filename + "\")");
}
} catch (RserveException | REXPMismatchException e) {
throw new REngineException(c, "RServe exception: " + e);
}
}
示例2: executeRCode
import org.rosuda.REngine.Rserve.RConnection; //导入方法依赖的package包/类
/**
* Execute a R code.
* @param source code to execute
* @throws REngineException if an error while executing the code
*/
public void executeRCode(final String source) throws REngineException {
if (source == null) {
return;
}
final RConnection c = getRConnection();
try {
// Execute the source
c.voidEval("source(\"" + source + "\")");
} catch (RserveException e) {
throw new REngineException(c, "RServe exception: " + e);
}
}
示例3: setCommandArgs
import org.rosuda.REngine.Rserve.RConnection; //导入方法依赖的package包/类
/**
* Override the commandArg() R function.
* @param arguments the arguments
* @throws REngineException if an error occurs while executing R code
*/
public void setCommandArgs(final List<String> arguments)
throws REngineException {
if (arguments == null) {
throw new NullPointerException("arguments argument cannot be null");
}
final StringBuilder sb = new StringBuilder();
sb.append("f <- function(trailingOnly = FALSE) { c(");
boolean first = true;
for (String arg : arguments) {
if (first) {
first = false;
} else {
sb.append(",");
}
sb.append('\'');
sb.append(arg);
sb.append('\'');
}
sb.append(") }");
final RConnection c = getRConnection();
try {
// Execute the source
c.voidEval(sb.toString());
} catch (RserveException e) {
throw new REngineException(c, "RServe exception: " + e);
}
}
示例4: executeRnwCode
import org.rosuda.REngine.Rserve.RConnection; //导入方法依赖的package包/类
/**
* Execute a R Sweave code.
* @param source code to execute
* @param latexOutput output latex filename
* @throws REngineException if an error while executing the code
*/
public void executeRnwCode(final String source, final String latexOutput)
throws REngineException {
if (source == null) {
return;
}
final RConnection c = getRConnection();
final StringBuilder sb = new StringBuilder();
sb.append("Sweave(\"");
sb.append(source);
sb.append('\"');
if (latexOutput != null) {
sb.append(", output=\"");
sb.append(latexOutput);
sb.append('\"');
}
sb.append(')');
try {
c.voidEval(sb.toString());
} catch (RserveException e) {
throw new REngineException(c, "Rserve exception: " + e);
}
}