Package org.renjin.sexp

Examples of org.renjin.sexp.ListVector


      if(i > 0) {
        buf.append("#");
      }
      buf.append(thisClass.asString());
    }
    ListVector classes = classListBuilder.build();
    method = ((Environment)mtable).getVariable(buf.toString());
    if(method == Symbol.UNBOUND_VALUE) {
      method = do_inherited_table(context, classes, fdef, mtable, (Environment)ev);
    }
    /* the rest of this is identical to R_standardGeneric;
View Full Code Here


  @Test
  public void simple() throws IOException {
   
    RdParser parser = new RdParser();
    ListVector result = (ListVector) parser.R_ParseRd(new StringReader("\\name{plotf}"), Null.INSTANCE, false);
    assertThat(result.length(), equalTo(1));
    ListVector header = (ListVector) result.getElementAsSEXP(0);
    assertThat(header.getAttribute(Symbol.get("Rd_tag")), equalTo(c("\\name")));

    StringVector name = (StringVector) header.getElementAsSEXP(0);
    assertThat(name, equalTo(c("plotf")));
    //assertThat(name.getAttribute(Symbol.get("Rd_tag")), equalTo(c("VERB")));
   
  }
View Full Code Here

  public void comparison() throws IOException {
   
    // output from C-R 2.12.1
    RDataReader reader = new RDataReader(topLevelContext, getClass().getResourceAsStream("expected.Rdata"));
    PairList.Node contents = (Node) reader.readFile();
    ListVector expected = contents.getElementAsSEXP(0);
   
    assertThat(expected.length(), equalTo(3));
   
    compareTree("test1.Rd", expected.get(0))
    compareTree("test2.Rd", expected.get(1));
    compareTree("test3.Rd", expected.get(2));
  }
View Full Code Here

  private void compareTree(String resourceName, SEXP expected) throws IOException {
    InputStream in = getClass().getResourceAsStream(resourceName);
    InputStreamReader reader = new InputStreamReader(in);
   
    RdParser parser = new RdParser();
    ListVector result = (ListVector) parser.R_ParseRd(reader, Null.INSTANCE, false);

    compareNode(resourceName, result, expected);
  }
View Full Code Here

  }
 
  @Test
  public void taggedVarArgs() {
    eval( "f <- function(...) { list(...) }");
    ListVector exp = (ListVector) eval( "f(x=1,y=2,z=3)");
    assertThat(exp.getName(0), equalTo("x"));
    assertThat(exp.getName(1), equalTo("y"));
    assertThat(exp.getName(2), equalTo("z"));

  }
View Full Code Here

@Test
  public void ellipsesPassedToClosureWithTags() {
    eval( "g<- function(...) { list(...) } ");
    eval( "f<- function(...) { g(...) }");
    ListVector exp = (ListVector) eval(" f(x=1,y=2,z=3) ");
    assertThat(exp.getName(0), equalTo("x"));
    assertThat(exp.getName(1), equalTo("y"));
    assertThat(exp.getName(2), equalTo("z"));
  }
View Full Code Here

    }
       
    // now compose the attributes that describe the matrix
    AttributeMap.Builder attributes = AttributeMap.builder();
    attributes.set(Symbols.DIM, new IntArrayVector(modelFrame.getNumRows(), columns.size()));
    attributes.set(Symbols.DIMNAMES, new ListVector(modelFrame.getRowNames(), columnNames(columns)));
    attributes.set(ModelMatrix.ASSIGN, assignment.build());
    // TODO: contrasts

    return new ModelMatrix(modelFrame.getNumRows(), columns, attributes.build());
  }
View Full Code Here

////        for ( i = length(ans) ; i-- ; )
////                copyMostAttribNoTs(VECTOR_ELT(data, i),VECTOR_ELT(ans, i));
//
//    } else {
   
      return new ListVector(data, attributes.build());
//   }
     
     
  }
View Full Code Here

TOP

Related Classes of org.renjin.sexp.ListVector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.