Rcpp gets an element by name - $ operator

In R I can write:

 l <- list(a=0, b="10"); 

And get the value of the list item named b as follows:

 x <– l$b 

Is there a way to get the same result using an Rcpp::List object?

+5
source share
1 answer

Of course, there are many examples. Just use

 std::string x = l["b"]; 

where l is an Rcpp::List object that supposedly has names.

+5
source

Source: https://habr.com/ru/post/1235242/


All Articles