作者gsuper (Logit(odds))
看板R_Language
标题[问题] Rcpp 初学
时间Tue Jan 27 17:22:32 2015
cppFunction(
'
int fx(
NumericVector x)
{ int ss = x.
size();
return ss;
}
'
)
---------------
在上述的 function 中
1.NumericVector
是否是 Rcpp 提供的特殊变数宣告方式?
还是这是正常的 C语言 之宣告?
[SEXP object]
Integer(Vector|Matrix) ; integer vectors and matrices
Numeric(Vector|Matrix) ; numeric
Logical(Vector|Matrix) ; logical
Character(Vector|Matrix) ; character
Raw(Vector|Matrix) ; raw
Complex(Vector|Matrix) ; complex
GenericVector ; list
--------------
2. x.size()
这是类似 size(x) 的感觉
请问 size() 是 C 的 function 还是 R 的?
---
查了以後发现是 C++ 的 vector::size() 的关系
但为何不需要写
#include <vector>?
http://www.cplusplus.com/reference/set/
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 114.32.201.238
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/R_Language/M.1422350556.A.34D.html
1F:推 memphis: matlab的XD (我乱入的 不要理我..我不懂这个) 01/27 17:27
※ 编辑: gsuper (114.32.201.238), 01/27/2015 17:37:05
※ 编辑: gsuper (114.32.201.238), 01/27/2015 17:42:15
※ 编辑: gsuper (114.32.201.238), 01/27/2015 17:56:47
※ 编辑: gsuper (114.32.201.238), 01/27/2015 17:57:42