<div dir="ltr"><div>This works:</div>







<div><br></div>#include <Rcpp.h><br>using namespace Rcpp;<br><br>// [[Rcpp::export]] <br>NumericVector fromList(List outer, std::string name) {<br>    return (as <List> (outer[0]) [name]);<div>}<br><br>/*** R<br>

x <- c(0.2855202, 0.6731716, 0.8497825, 0.7445254, 0.2382722)<br>innL <- list(p=x)<br>outL <- list(List1=innL)<br>fromList(outL, "p")<br>*/<div><br></div><div><div>> sourceCpp("~/Desktop/dion.cpp")</div>

<div>> x <- c(0.2855202, 0.6731716, 0.8497825, 0.7445254, 0.2382722)<br></div><div>> innL <- list(p=x)<br></div><div>> outL <- list(List1=innL)<br></div><div>> fromList(outL, "p")<br></div>
<div>
[1] 0.2855202 0.6731716 0.8497825 0.7445254 0.2382722</div></div></div></div>