Hi Tal, > That is, say that we have x as a List, how do we go about fetching its attr? > I tried: > x[1].attr("type") > x.attr[1]("type") > But none seemed to have worked. Any suggestions there?
Here is a script to show you how to access them: ```r x <- list(a = 1, b = 2, c = list(ca = 3, cb = 4, 5), 6) attr(x[[1]], "type") = "fun" attr(x[[3]][[1]], "type") = "fun" x library(inline);library(Rcpp) f <- cxxfunction(sig=c(Rx="list"), plugin="Rcpp", body=' List x(Rx); IntegerVector a(wrap(x[0])); Rcout << as<std::string>(a.attr("type")) << std::endl; List c(wrap(x[2])); IntegerVector ca(wrap(c[0])); Rcout << as<std::string>(ca.attr("type")) << std::endl; ') f(x) ``` I hope it helps. Wush
_______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel