Commit f43db5e0 authored by Zack Galbreath's avatar Zack Galbreath Committed by Code Review

Merge topic 'R_row_names' into master

48341cd5 copy row names from R to vtkTable
parents 0b03bebf 48341cd5
......@@ -357,12 +357,23 @@ vtkTable* vtkRAdapter::RToVTKTable(SEXP variable)
nc = Rf_ncols(variable);
nr = Rf_nrows(variable);
result = vtkTable::New();
names = getAttrib(variable, R_DimNamesSymbol);
if(!isNull(names))
{
vtkStringArray* rowNames = vtkStringArray::New();
for (i = 0; i < nr; ++i)
{
std::string rowName = CHAR(STRING_ELT(VECTOR_ELT(names,0),i));
rowNames->InsertNextValue(rowName);
}
result->AddColumn(rowNames);
rowNames->Delete();
}
for(j=0;j<nc;j++)
{
vtkDoubleArray* da = vtkDoubleArray::New();
da->SetNumberOfComponents(1);
names = getAttrib(variable, R_DimNamesSymbol);
if(!isNull(names))
{
da->SetName(CHAR(STRING_ELT(VECTOR_ELT(names,1),j)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment