Question

Simple question that I can't seem to find the answer to. How would I get an attribute of an R object in rpy2? For example, what's the equivalent of the R code: m$eval in rpy2?

Was it helpful?

Solution

For R lists, $ is equivalent to [[ with a vector of length 1: foo$bar is equivalent to foo[["bar"]]. With rpy2 this would be foo.rx2('bar'), or foo[foo.index('bar')] (See extracting element, R-style).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top