RcppResultSet(RcppExamples)
RcppResultSet()所属R语言包:RcppExamples
C++ class for sending C++ objects back to R
C + +类用于发送C + +对象返回R
译者:生物统计家园网 机器人LoveR
描述----------Description----------
RcppResultSet is a C++ class defined in RcppResultSet.h that can assign any number of C++ objects to R in a single named list object as the SEXP return value of a .Call() function call. It is part of the classic API.
RcppResultSet是一个C + +类中定义RcppResultSet.h,可以指定任意数量的C + +对象中的RSEXP一个.Call()函数调用的返回值一个命名列表对象。这是经典的API的一部分。
The C++ objects can be of different types that are limited to types double, int, string, vectors of double or int (with explicit dimensions), matrices of double or int (with explicit dimensions), STL vectors of double, int or string, STL "vector of vectors" of types double or int (all with implicit dimensions), the internal types RcppDate, RcppDateVector, RcppStringVector, RcppVector of types double or int, RcppMatrix of types double or int as well RcppFrame, a type that can be converted into a data.frame, and the R type SEXP.
C + +对象可以是不同的类型,是有限的类型double,int,string,向量double或int有明确的尺寸, double或int有明确的尺寸,STL向量double,int或string,STL向量,向量类型的矩阵 double或int隐含的尺寸,内部RcppDate,RcppDateVector,RcppStringVector,RcppVector类double或int,RcppMatrix类型double或int以及RcppFrame,可以被转换成一个data.frame,和R的类型,类型SEXP。
Where applicable, the C++ types are automatically converted to the corresponding R types structures around types numeric, integer, or character. The C++ code can all be retrieved in R as elements of a named list object.
在适用的情况下,C++类型自动转换到相应的R型结构,围绕类型numeric,integer或character。 C++代码都可以在R检索的命名列表对象的元素。
The new API has more generic templated functions.
新的API有更通用的模板功能。
Details
详细信息----------Details----------
Usage of RcppResultSet from C++ is fully defined in RcppResultSet.h. An example for returning data to R at the end of a .Call() call follows.
用法RcppResultSetC++完全定义在RcppResultSet.h。返回数据到R.Call()呼叫结束时的一个例子如下。
At the C++ level, the corresponding code to assign these parameter to C++ objects is can be as follows (taken from the C++ source of RcppExample):
在C + +的水平,相应的代码来指定这些参数的C + +对象可以是如下(从C + +源代码的RcppExample):
(作者)----------Author(s)----------
Dominick Samperi wrote the initial versions of Rcpp (and
RcppTemplate) during 2005 and 2006. Dirk Eddelbuettel made some
additions, and became maintainer in 2008. Dirk Eddelbuettel and Romain
Francois have been extending Rcpp since 2009.
参见----------See Also----------
RcppExample.
RcppExample。
实例----------Examples----------
# example from RcppDate[例如从RcppDate中]
# set up date and datetime vectors[成立日期和日期时间向量]
dvec <- Sys.Date() + -2:2
dtvec <- Sys.time() + (-2:2)*0.5
# call the underlying C++ function[调用底层的C + +函数]
result <- RcppDateExample(dvec, dtvec)
# inspect returned object[检查返回的对象]
result
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|