org.rosuda.JGR
Class RController

java.lang.Object
  extended by org.rosuda.JGR.RController

public class RController
extends Object

RController - implementations of an interface between JGR and Rengine, providing all needed functions for working with R.

Author:
Markus Helbig RoSuDa 2003 - 2005

Field Summary
static Object dummy
          dummy object.
 
Constructor Summary
RController()
           
 
Method Summary
static String commonWithPrefix(String str1, String str2)
          Compare to string and return the common prefix.
static String[] completeCommand(String partOfCmd)
          Show all posibilities to complete your given part of a command.
static String[] completeFile(String part)
          Completetion of a file (doesn't supports multiple fils yet).
static Vector createContent(RObject o, Collection c)
          Get the content of an RObject (list, data.frame, table, matrix).
static RModel createRModel(String sx, String type)
          Create RModel (java-side) out of R
static RObject createRObject(String sx, String type, RObject parent, boolean b)
          Ceates an (java-side) out of R
static boolean export(SVarSet vs, String type)
          Export an SVarSet to R.
static String getCurrentPackages()
          Get R_DEFAULT_PACKAGES.
static String[] getDefaultPackages()
          Get current installed packages
static String getFunHelpTip(String s)
           
static String[] getKeyWords()
          Get all keywords for syntaxhighlighting.
static String[] getObjects()
          Get object names used for syntaxhighlighting.
static String getRContinue()
          Get R continue
static String getRHome()
          Get R_HOME.
static String[] getRLibs()
          Get R_LIBS.
static String getRPrompt()
          Get R prompt
static String getSummary(RObject o)
          Get summary of an RObject, R-command summary(...).
static void newFunction(RObject o)
           
static SVarSet newSet(RObject o)
          Create a new SVarSet of the specified RObject.
static SVar newVar(SVarSet cvs, String name, double[] d)
          Construct a new numerical variable from supplied array of doubles.
static SVar newVar(SVarSet cvs, String name, int[] d)
          Construct a new numerical variable from supplied array of integers.
static SVar newVar(SVarSet cvs, String name, int[] ix, String[] d)
           
static SVar newVar(SVarSet cvs, String name, String[] d)
          Construct a new categorical variable from supplied array of strings.
static void refreshObjects()
          Browse the workspace for objects and put them in JGR.MODELS, JGR.DATA, JGR.OTHER and JGR.FUNCTIONS. currently only these things which are provided by R-command: ls(pos=1).
static Object[][] refreshPackages()
          Get information about all packages (loaded, undloaded, defaults ...).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dummy

public static Object dummy
dummy object.

Constructor Detail

RController

public RController()
Method Detail

getRHome

public static String getRHome()
Get R_HOME.

Returns:
R_HOME path

getRLibs

public static String[] getRLibs()
Get R_LIBS.

Returns:
R_LIBS paths

getRPrompt

public static String getRPrompt()
Get R prompt

Returns:
prompt

getRContinue

public static String getRContinue()
Get R continue

Returns:
continue

getCurrentPackages

public static String getCurrentPackages()
Get R_DEFAULT_PACKAGES.

Returns:
default packages

getDefaultPackages

public static String[] getDefaultPackages()
Get current installed packages

Returns:
installed packages

completeCommand

public static String[] completeCommand(String partOfCmd)
Show all posibilities to complete your given part of a command.

Parameters:
partOfCmd - part which you want to complete
Returns:
possible completions

completeFile

public static String[] completeFile(String part)
Completetion of a file (doesn't supports multiple fils yet).

Parameters:
part - of file to complete
Returns:
file

getKeyWords

public static String[] getKeyWords()
Get all keywords for syntaxhighlighting.

Returns:
keywords

getObjects

public static String[] getObjects()
Get object names used for syntaxhighlighting.

Returns:
objects

refreshObjects

public static void refreshObjects()
Browse the workspace for objects and put them in JGR.MODELS, JGR.DATA, JGR.OTHER and JGR.FUNCTIONS. currently only these things which are provided by R-command: ls(pos=1).


refreshPackages

public static Object[][] refreshPackages()
Get information about all packages (loaded, undloaded, defaults ...).

Returns:
package information

createContent

public static Vector createContent(RObject o,
                                   Collection c)
Get the content of an RObject (list, data.frame, table, matrix).

Parameters:
o - RObject
c - all found objects are collected in c (currently disabled)
Returns:
vector of RObject

createRObject

public static RObject createRObject(String sx,
                                    String type,
                                    RObject parent,
                                    boolean b)
Ceates an (java-side) out of R

Parameters:
sx - name
type - type
parent - parent
b - names(..) provides real names or not
Returns:
new RObject

createRModel

public static RModel createRModel(String sx,
                                  String type)
Create RModel (java-side) out of R

Parameters:
sx - name
type - type (currently only lm and glm is supported
Returns:
new RModel

getFunHelpTip

public static String getFunHelpTip(String s)

getSummary

public static String getSummary(RObject o)
Get summary of an RObject, R-command summary(...).

Parameters:
o - RObject
Returns:
summary of object

newFunction

public static void newFunction(RObject o)

newSet

public static SVarSet newSet(RObject o)
Create a new SVarSet of the specified RObject.

Parameters:
o - RObject which should be parsed into the dataset
Returns:
new dataset

newVar

public static SVar newVar(SVarSet cvs,
                          String name,
                          double[] d)
Construct a new numerical variable from supplied array of doubles.

Parameters:
name - variable name
d - array of doubles
Returns:
SVar

newVar

public static SVar newVar(SVarSet cvs,
                          String name,
                          int[] d)
Construct a new numerical variable from supplied array of integers.

Parameters:
name - variable name
d - array of integers
Returns:
SVar

newVar

public static SVar newVar(SVarSet cvs,
                          String name,
                          String[] d)
Construct a new categorical variable from supplied array of strings.

Parameters:
name - variable name
d - array of strings
Returns:
SVar

newVar

public static SVar newVar(SVarSet cvs,
                          String name,
                          int[] ix,
                          String[] d)

export

public static boolean export(SVarSet vs,
                             String type)
Export an SVarSet to R.

Parameters:
vs - dataset
type - R-class of RObject behind vs
Returns:
true if successful, false if not

commonWithPrefix

public static String commonWithPrefix(String str1,
                                      String str2)
Compare to string and return the common prefix.

Parameters:
str1 - String 1
str2 - String 2
Returns:
common prefix