Perfect, thank you

On Tue, May 6, 2014 at 1:01 PM, Romain Francois <rom...@r-enthusiasts.com>wrote:

>
> Le 6 mai 2014 à 09:35, Florian Burkart <florian.burk...@gmail.com> a
> écrit :
>
> > Hi,
> >
> > I have been creating lists of lists with
> >
> > return Rcpp::List::create(Rcpp::Named("vec") = someVector,
> >                           Rcpp::Named("lst") = someList,
> >                           Rcpp::Named("vec2") = someOtherVector);
> >
> > or to follow Romain:
> >
> > using namespace Rcpp ;
> > return List::create(
> >    _["vec"]  = someVector,
> >    _["lst"]  = someList,
> >    _["vec2"] = someOtherVector
> >  ) ;
> >
> > But how do I convert the following into a list of lists?
> >
> > std::vector<std::string> m_column_headers;
> > std::vector<std::vector<OptDouble> > m_vectors_of_values;
>
> You probably just need to know about .names() =, i.e. something like this
> should do:
>
> List values = wrap(m_vectors_of_values) ;
> values.names()  = m_column_headers ;
>
> FWIW, in Rcpp11, you could use structure, e.g. :
>
> List values = structure( m_vectors_of_values, _["names"] =
> m_column_headers ) ;
>
> Romain
_______________________________________________
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

Reply via email to