Package org.math.R
Class RenjinSession
- java.lang.Object
-
- org.math.R.Rsession
-
- org.math.R.RenjinSession
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.math.R.Rsession
Rsession.Function, Rsession.RException
-
Nested classes/interfaces inherited from interface org.math.R.RLog
RLog.Level
-
-
Field Summary
Fields Modifier and Type Field Description protected org.renjin.script.RenjinScriptEngineR-
Fields inherited from class org.math.R.Rsession
_PACKAGE_, CAST_ERROR, debug, DEFAULT_REPOS, envName, GRAPHIC_BMP, GRAPHIC_JPEG, GRAPHIC_PNG, GRAPHIC_TIFF, HEAD_SET, HEAD_TRY, PACKAGEINSTALLED, PACKAGELOADED, repos, SAVE_ASCII, TRY_MODE, TRY_MODE_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description RenjinSession(PrintStream p, Properties properties)RenjinSession(RLog console, Properties properties)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]asArray(Object o)doubleasDouble(Object o)intasInteger(Object o)int[]asIntegers(Object o)MapasList(Object o)booleanasLogical(Object o)boolean[]asLogicals(Object o)double[][]asMatrix(Object o)StringasString(Object o)String[]asStrings(Object o)Objectcast(Object o)voidcloseLog()voidcopyGlobalEnv(String envName)voidgetFileFromWorkspace(File file)Stringgethomedir()Stringgetwd()StringinstallPackage(String pack, boolean load)Start installation procedure of CRAN R packageStringinstallPackage(String pack, File dir, boolean load)Start installation procedure of local R packagebooleanisAvailable()booleanisNull(Object o)static voidmain(String[] args)static RenjinSessionnewInstance(RLog console, Properties properties)Stringprint(String command)Get R command text outputFileputFileInWorkspace(File file)booleanset(String varname, double[][] data, String... names)Set R data.frame in R env.booleanset(String varname, Object var)Set R object in R env.voidsetCRANRepository(String url)voidsetGlobalEnv(String envName)ObjectsilentlyRawEval(String expression, boolean tryEval)Silently (ie no log) launch R command and return value.booleansilentlyVoidEval(String expression, boolean tryEval)Silently (ie no log) launch R command without return value.StringtoString(Object o)-
Methods inherited from class org.math.R.Rsession
addBusyListener, addEvalListener, addLogger, addUpdateObjectsListener, asHTML, asR2HTML, buildList, buildListPattern, buildListString, cat, cat, cat, cat, cat, cat, cat, end, eval, eval, finalize, getGlobalEnv, getLastError, getLastLogEntry, getLastOutput, getRepository, hash, installPackage, installPackages, isPackageInstalled, isPackageLoaded, listCommands, load, loadPackage, local2remotePath, log, ls, ls, ls, note_code, note_code, note_header, note_text, notebook, proxyEval, rawEval, rawEval, remote2localPath, removeBusyListener, removeEvalListener, removeLogger, removeUpdateObjectsListener, reshapeAsRow, reshapeAsRow, rm, rmAll, rmAll, rmls, save, savels, set, setBusy, setRepository, setwd, silentlyRawEval, silentlyVoidEval, sinkMessage, sinkOutput, source, t, toBMP, toGraphic, toGraphic, toHTML, toJPEG, toPNG, toRcode, toRcode, toRcode, toRcode, toRcode, toRcode, toRcode, toRpath, toRpath, toTIFF, typeOf, unset, unset, voidEval, voidEval
-
-
-
-
Constructor Detail
-
RenjinSession
public RenjinSession(RLog console, Properties properties)
-
RenjinSession
public RenjinSession(PrintStream p, Properties properties)
-
-
Method Detail
-
newInstance
public static RenjinSession newInstance(RLog console, Properties properties)
-
gethomedir
public String gethomedir()
- Specified by:
gethomedirin classRsession
-
silentlyVoidEval
public boolean silentlyVoidEval(String expression, boolean tryEval)
Description copied from class:RsessionSilently (ie no log) launch R command without return value.- Specified by:
silentlyVoidEvalin classRsession- Parameters:
expression- R expresison to evaluatetryEval- encapsulate command in try() to cacth errors- Returns:
- well evaluated ?
-
silentlyRawEval
public Object silentlyRawEval(String expression, boolean tryEval)
Description copied from class:RsessionSilently (ie no log) launch R command and return value.- Specified by:
silentlyRawEvalin classRsession- Parameters:
expression- R expression to evaluatetryEval- encapsulate command in try() to cacth errors- Returns:
- REXP R expression
-
set
public boolean set(String varname, double[][] data, String... names)
Description copied from class:RsessionSet R data.frame in R env.
-
set
public boolean set(String varname, Object var)
Description copied from class:RsessionSet R object in R env.
-
asDouble
public double asDouble(Object o) throws ClassCastException
- Specified by:
asDoublein classRsession- Throws:
ClassCastException
-
asArray
public double[] asArray(Object o) throws ClassCastException
- Specified by:
asArrayin classRsession- Throws:
ClassCastException
-
asMatrix
public double[][] asMatrix(Object o) throws ClassCastException
- Specified by:
asMatrixin classRsession- Throws:
ClassCastException
-
asString
public String asString(Object o) throws ClassCastException
- Specified by:
asStringin classRsession- Throws:
ClassCastException
-
asStrings
public String[] asStrings(Object o) throws ClassCastException
- Specified by:
asStringsin classRsession- Throws:
ClassCastException
-
asInteger
public int asInteger(Object o) throws ClassCastException
- Specified by:
asIntegerin classRsession- Throws:
ClassCastException
-
asIntegers
public int[] asIntegers(Object o) throws ClassCastException
- Specified by:
asIntegersin classRsession- Throws:
ClassCastException
-
asLogical
public boolean asLogical(Object o) throws ClassCastException
- Specified by:
asLogicalin classRsession- Throws:
ClassCastException
-
asLogicals
public boolean[] asLogicals(Object o) throws ClassCastException
- Specified by:
asLogicalsin classRsession- Throws:
ClassCastException
-
asList
public Map asList(Object o) throws ClassCastException
- Specified by:
asListin classRsession- Throws:
ClassCastException
-
closeLog
public void closeLog()
-
cast
public Object cast(Object o) throws ClassCastException
- Specified by:
castin classRsession- Throws:
ClassCastException
-
setCRANRepository
public void setCRANRepository(String url)
- Overrides:
setCRANRepositoryin classRsession- Parameters:
url- CRAN repository to use for packages installation (eg http://cran.r-project.org)
-
installPackage
public String installPackage(String pack, boolean load)
Description copied from class:RsessionStart installation procedure of CRAN R package- Overrides:
installPackagein classRsession- Parameters:
pack- package to installload- automatically load package after successfull installation- Returns:
- installation status
-
installPackage
public String installPackage(String pack, File dir, boolean load)
Description copied from class:RsessionStart installation procedure of local R package- Overrides:
installPackagein classRsession- Parameters:
pack- package to installdir- directory where package file (.zip, .tar.gz or .tgz) is located.load- automatically load package after successfull installation- Returns:
- installation status
-
isAvailable
public boolean isAvailable()
- Specified by:
isAvailablein classRsession
-
putFileInWorkspace
public File putFileInWorkspace(File file)
- Specified by:
putFileInWorkspacein classRsession
-
getFileFromWorkspace
public void getFileFromWorkspace(File file)
- Specified by:
getFileFromWorkspacein classRsession
-
setGlobalEnv
public void setGlobalEnv(String envName)
- Specified by:
setGlobalEnvin classRsession
-
copyGlobalEnv
public void copyGlobalEnv(String envName)
- Specified by:
copyGlobalEnvin classRsession
-
-