作者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/m.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