diff --git a/src/EnvironmentWatcher.cpp b/src/EnvironmentWatcher.cpp index 2daae2f..d58e238 100644 --- a/src/EnvironmentWatcher.cpp +++ b/src/EnvironmentWatcher.cpp @@ -484,10 +484,10 @@ RC2::EnvironmentWatcher::setDimNames ( RObject& robj, json& jobj ) jobj["dims"] = rvectorToJsonArray(robj); } if (robj.hasAttribute("dimnames")) { - RObject mlist(robj.attr("dimnames")); + Rcpp::List mlist(robj.attr("dimnames")); json dnames; - for (int i=0; i < LENGTH(mlist); i++) { - RObject cl(VECTOR_ELT(mlist, i)); + for (int i=0; i < mlist.length(); i++) { + RObject cl(mlist[i]); dnames.push_back(rvectorToJsonArray(cl)); } jobj["dimnames"] = dnames;