本文整理汇总了Java中org.rosuda.REngine.REXP.isNull方法的典型用法代码示例。如果您正苦于以下问题:Java REXP.isNull方法的具体用法?Java REXP.isNull怎么用?Java REXP.isNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.rosuda.REngine.REXP
的用法示例。
在下文中一共展示了REXP.isNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConfigureDbResultSlog
import org.rosuda.REngine.REXP; //导入方法依赖的package包/类
public String[][] getConfigureDbResultSlog() throws RserveException, REngineException, REXPMismatchException {
// Example screenlog: data.frame(Plate=c(1),Well=c("A02"),Sample=c(1),Flag=c("NA"),Channel=c(1),stringsAsFactors=FALSE)
RserveExtensions rserveExtensions = new RserveExtensions();
REXP rexpPlate = rserveExtensions.tryEval(rConnection, "screenLog <- [email protected]; resultContent <- screenLog$Plate");
REXP rexpWell = rserveExtensions.tryEval(rConnection, "resultContent <- screenLog$Well");
REXP rexpSample = rserveExtensions.tryEval(rConnection, "resultContent <- screenLog$Sample"); //Sample = Replicate
REXP rexpFlag = rserveExtensions.tryEval(rConnection, "resultContent <- screenLog$Flag");
REXP rexpChannel = rserveExtensions.tryEval(rConnection,"resultContent <- screenLog$Channel");
String [][] result =null;
if (!rexpPlate.isNull()) {
// all have the same length
result = new String[5][rexpPlate.asStrings().length];
result[0] = rexpPlate.asStrings();
result[1] = rexpWell.asStrings();
result[2] = rexpSample.asStrings();
result[3] = rexpFlag.asStrings();
result[4] = rexpChannel.asStrings();
}
return result;
}
示例2: eval
import org.rosuda.REngine.REXP; //导入方法依赖的package包/类
@Override
public <T> T eval(String command) throws FOSException {
try {
if(logger.isTraceEnabled()) {
logger.trace(command);
}
connection.assign("trycodeblock", command);
REXP result = connection.parseAndEval("try(eval(parse(text=trycodeblock)),silent=TRUE)");
if (result != null && result.inherits("try-error")) {
throw new FOSException(result.toDebugString());
}
if (result == null || result.isNull()) {
return null;
} else if( result.isVector() && result.isNumeric()) {
return (T) result.asDoubles();
} else if (result.isInteger()) {
return (T) new Integer(result.asInteger());
} else if (result.isNumeric()) {
return (T) new Double(result.asDouble());
} else if (result.isString()) {
return (T) result.asString();
}
return null;
} catch (Exception e) {
throw new FOSException("Error executing R script.", e);
}
}