Tabnine Logo
org.rosuda.REngine
Code IndexAdd Tabnine to your IDE (free)

How to use org.rosuda.REngine

Best Java code snippets using org.rosuda.REngine (Showing top 20 results out of 315)

origin: net.rforge/REngine

/** create a new factor REXP from an existing RFactor
 *  @param factor factor object (can be of any index base, the contents will be pulled with base 1) */
public REXPFactor(RFactor factor) {
  super(factor.asIntegers(1));
  this.factor = factor;
  this.levels = factor.levels();
  attr = new REXPList(
            new RList(
                 new REXP[] {
                   new REXPString(this.levels), new REXPString("factor")
                 }, new String[] { "levels", "class" }));
}

origin: org.rosuda.REngine/REngine

/** retrieve an attribute of the given name from this object
 * @param name attribute name
 * @return attribute value or <code>null</code> if the attribute does not exist */
public REXP getAttribute(String name) {
  final REXPList a = _attr();
  if (a==null || !a.isList()) return null;
  return a.asList().at(name);
}

origin: org.rosuda.REngine/REngine

/** convenience method equivalent to <code>assign(symbol, new REXPString(d), null)</code> (see {@link #assign(String, REXP, REXP)})
 @param symbol symbol name to assign to
 @param d value to assign */
public void assign(String symbol, String d) throws REngineException { try { assign(symbol, new REXPString(d), null); } catch (REXPMismatchException e) { throw(new REngineException(this, "REXPMismatchException in assign(,String[]): "+e)); } }
/** convenience method equivalent to <code>assign(symbol, value, null)</code> (see {@link #assign(String, REXP, REXP)})
origin: org.rosuda.REngine/REngine

/** returns dimensions of the object (as determined by the "<code>dim</code>" attribute)
 * @return an array of integers with corresponding dimensions or <code>null</code> if the object has no dimension attribute */
public int[] dim() {
  try {
    return hasAttribute("dim")?_attr().asList().at("dim").asIntegers():null;
  } catch (REXPMismatchException me) {
  }
  return null;
}

origin: org.rosuda.REngine/REngine

/** creates a new generic vector from a list. If the list is named, the <code>"names"</code> attribute is created automatically from it.
 *  @param list list to create the vector from */
public REXPGenericVector(RList list) {
  super();
  payload=(list==null)?new RList():list;
  // automatically generate 'names' attribute
  if (payload.isNamed())
    attr = new REXPList(
      new RList(new REXP[] { new REXPString(payload.keys()) },
           new String[] { "names" }));
}

origin: org.rosuda.REngine/REngine

/** convenience method equivalent to <code>assign(symbol, new REXPInteger(d), null)</code> (see {@link #assign(String, REXP, REXP)})
 @param symbol symbol name to assign to
 @param d values to assign */
public void assign(String symbol, int[] d) throws REngineException { try { assign(symbol, new REXPInteger(d), null); } catch (REXPMismatchException e) { throw(new REngineException(this, "REXPMismatchException in assign(,int[]): "+e)); } }
/** convenience method equivalent to <code>assign(symbol, new REXPString(d), null)</code> (see {@link #assign(String, REXP, REXP)})
origin: org.rosuda.REngine/REngine

/** convenience method equivalent to <code>assign(symbol, new REXPDouble(d), null)</code> (see {@link #assign(String, REXP, REXP)})
 @param symbol symbol name to assign to
 @param d values to assign */
public void assign(String symbol, double[] d) throws REngineException { try { assign(symbol, new REXPDouble(d), null); } catch (REXPMismatchException e) { throw(new REngineException(this, "REXPMismatchException in assign(,double[]): "+e)); } }
/** convenience method equivalent to <code>assign(symbol, new REXPInteger(d), null)</code> (see {@link #assign(String, REXP, REXP)})
origin: org.rosuda.REngine/REngine

/** convenience method equivalent to <code>assign(symbol, new REXPRaw(d), null)</code> (see {@link #assign(String, REXP, REXP)})
 @param symbol symbol name to assign to
 @param d values to assign */
public void assign(String symbol, byte[] d) throws REngineException { try { assign(symbol, new REXPRaw(d), null); } catch (REXPMismatchException e) { throw(new REngineException(this, "REXPMismatchException in assign(,byte[]): "+e)); } }
/** convenience method equivalent to <code>assign(symbol, new REXPString(d), null)</code> (see {@link #assign(String, REXP, REXP)})
origin: org.rosuda.REngine/REngine

/** returns the parent environment or a reference to it
 *  @param resolve if <code>true</code> returns the environemnt, otherwise a reference. 
 *  @return parent environemnt (or a reference to it) */
public REXP parent(boolean resolve) throws REngineException {
  try {
    return eng.getParentEnvironment(this, resolve);
  } catch (REXPMismatchException e) { // this should never happen because this is always guaranteed to be REXPEnv
    throw(new REngineException(eng, "REXPMismatchException:"+e+" in parent()"));
  }
}
origin: net.rforge/REngine

/** returns dimensions of the object (as determined by the "<code>dim</code>" attribute)
 * @return an array of integers with corresponding dimensions or <code>null</code> if the object has no dimension attribute */
public int[] dim() {
  try {
    return hasAttribute("dim")?_attr().asList().at("dim").asIntegers():null;
  } catch (REXPMismatchException me) {
  }
  return null;
}

origin: net.rforge/REngine

/** retrieve an attribute of the given name from this object
 * @param name attribute name
 * @return attribute value or <code>null</code> if the attribute does not exist */
public REXP getAttribute(String name) {
  final REXPList a = _attr();
  if (a==null || !a.isList()) return null;
  return a.asList().at(name);
}

origin: net.rforge/REngine

/** creates a new generic vector from a list. If the list is named, the <code>"names"</code> attribute is created automatically from it.
 *  @param list list to create the vector from */
public REXPGenericVector(RList list) {
  super();
  payload=(list==null)?new RList():list;
  // automatically generate 'names' attribute
  if (payload.isNamed())
    attr = new REXPList(
      new RList(new REXP[] { new REXPString(payload.keys()) },
           new String[] { "names" }));
}

origin: org.rosuda.REngine/REngine

/** create a new factor REXP from an existing RFactor
 *  @param factor factor object (can be of any index base, the contents will be pulled with base 1) */
public REXPFactor(RFactor factor) {
  super(factor.asIntegers(1));
  this.factor = factor;
  this.levels = factor.levels();
  attr = new REXPList(
            new RList(
                 new REXP[] {
                   new REXPString(this.levels), new REXPString("factor")
                 }, new String[] { "levels", "class" }));
}

origin: org.rosuda.REngine/REngine

/** convenience method equivalent to <code>assign(symbol, new REXPString(d), null)</code> (see {@link #assign(String, REXP, REXP)})
 @param symbol symbol name to assign to
 @param d values to assign */
public void assign(String symbol, String[] d) throws REngineException { try { assign(symbol, new REXPString(d), null); } catch (REXPMismatchException e) { throw(new REngineException(this, "REXPMismatchException in assign(,String[]): "+e)); } }
/** convenience method equivalent to <code>assign(symbol, new REXPRaw(d), null)</code> (see {@link #assign(String, REXP, REXP)})
origin: net.rforge/REngine

/** convenience method equivalent to <code>assign(symbol, new REXPInteger(d), null)</code> (see {@link #assign(String, REXP, REXP)})
 @param symbol symbol name to assign to
 @param d values to assign */
public void assign(String symbol, int[] d) throws REngineException { try { assign(symbol, new REXPInteger(d), null); } catch (REXPMismatchException e) { throw(new REngineException(this, "REXPMismatchException in assign(,int[]): "+e)); } }
/** convenience method equivalent to <code>assign(symbol, new REXPString(d), null)</code> (see {@link #assign(String, REXP, REXP)})
origin: net.rforge/REngine

/** convenience method equivalent to <code>assign(symbol, new REXPDouble(d), null)</code> (see {@link #assign(String, REXP, REXP)})
 @param symbol symbol name to assign to
 @param d values to assign */
public void assign(String symbol, double[] d) throws REngineException { try { assign(symbol, new REXPDouble(d), null); } catch (REXPMismatchException e) { throw(new REngineException(this, "REXPMismatchException in assign(,double[]): "+e)); } }
/** convenience method equivalent to <code>assign(symbol, new REXPInteger(d), null)</code> (see {@link #assign(String, REXP, REXP)})
origin: net.rforge/REngine

/** convenience method equivalent to <code>assign(symbol, new REXPRaw(d), null)</code> (see {@link #assign(String, REXP, REXP)})
 @param symbol symbol name to assign to
 @param d values to assign */
public void assign(String symbol, byte[] d) throws REngineException { try { assign(symbol, new REXPRaw(d), null); } catch (REXPMismatchException e) { throw(new REngineException(this, "REXPMismatchException in assign(,byte[]): "+e)); } }
/** convenience method equivalent to <code>assign(symbol, new REXPString(d), null)</code> (see {@link #assign(String, REXP, REXP)})
origin: org.rosuda.REngine/REngine

/** checks whether this obejct has a given attribute
 * @param name attribute name
 * @return <code>true</code> if the attribute exists, <code>false</code> otherwise */
public boolean hasAttribute(String name) {
  final REXPList a = _attr();
  return (a!=null && a.isList() && a.asList().at(name)!=null);
}

origin: net.rforge/REngine

/** convenience method equivalent to <code>assign(symbol, new REXPString(d), null)</code> (see {@link #assign(String, REXP, REXP)})
 @param symbol symbol name to assign to
 @param d values to assign */
public void assign(String symbol, String[] d) throws REngineException { try { assign(symbol, new REXPString(d), null); } catch (REXPMismatchException e) { throw(new REngineException(this, "REXPMismatchException in assign(,String[]): "+e)); } }
/** convenience method equivalent to <code>assign(symbol, new REXPRaw(d), null)</code> (see {@link #assign(String, REXP, REXP)})
origin: net.rforge/REngine

/** checks whether this obejct has a given attribute
 * @param name attribute name
 * @return <code>true</code> if the attribute exists, <code>false</code> otherwise */
public boolean hasAttribute(String name) {
  final REXPList a = _attr();
  return (a!=null && a.isList() && a.asList().at(name)!=null);
}

org.rosuda.REngine

Most used classes

  • REXP
    Basic class representing an object of any type in R. Each type in R in represented by a specific sub
  • REXPLogical
    REXPLogical represents a vector of logical values (TRUE, FALSE or NA). Unlike Java's boolean type R'
  • REXPString
    REXPString represents a character vector in R.
  • REXPDouble
    REXPDouble represents a vector of double precision floating point values.
  • REXPInteger
    REXPDouble represents a vector of integer values.
  • RList,
  • RConnection,
  • REXPList,
  • REngineException,
  • REXPFactor,
  • REXPGenericVector,
  • REXPRaw,
  • REXPVector,
  • RFileInputStream,
  • RFileOutputStream,
  • RserveException,
  • REXPLanguage,
  • REXPSymbol,
  • REngine
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now