On 16 September 2016 at 16:59, Amina Shahzadi wrote:
| Hello Friends
|
| I tried to find that how we can use pnorm(), dpois() etc. using arma library.
| It is easy to use using Rcpp. Would anybody help ?
Here you go:
R> library(Rcpp)
R> cppFunction("arma::vec foo() { return as<arma::vec>( rnorm(5) ); }",
depends="RcppArmadillo")
R> set.seed(42); foo()
[,1]
[1,] 1.370958
[2,] -0.564698
[3,] 0.363128
[4,] 0.632863
[5,] 0.404268
R>
R> set.seed(42); rnorm(5)
[1] 1.370958 -0.564698 0.363128 0.632863 0.404268
R>
There are literally hundreds of more complex examples out there. Just search.
Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | [email protected]
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel