66[ ![ Build
77Status] ( https://github.com/Enchufa2/RcppXPtrUtils/actions/workflows/build.yml/badge.svg )] ( https://github.com/Enchufa2/RcppXPtrUtils/actions/workflows/build.yml )
88[ ![ Coverage
9- Status] ( https://codecov.io/gh/Enchufa2/RcppXPtrUtils/branch/master/graph/badge.svg )] ( https://codecov.io/gh/Enchufa2/RcppXPtrUtils )
9+ Status] ( https://codecov.io/gh/Enchufa2/RcppXPtrUtils/branch/master/graph/badge.svg )] ( https://app. codecov.io/gh/Enchufa2/RcppXPtrUtils )
1010[ ![ CRAN_Status_Badge] ( https://www.r-pkg.org/badges/version/RcppXPtrUtils )] ( https://cran.r-project.org/package=RcppXPtrUtils )
1111[ ![ Downloads] ( https://cranlogs.r-pkg.org/badges/RcppXPtrUtils )] ( https://cran.r-project.org/package=RcppXPtrUtils )
1212
@@ -22,12 +22,11 @@ Install the release version from CRAN:
2222install.packages(" RcppXPtrUtils" )
2323```
2424
25- The installation from GitHub requires the
26- [ devtools ] ( https://github.com/hadley/devtools ) package.
25+ The installation from GitHub can be done with the
26+ [ remotes ] ( https://cran.r-project.org/package=remotes ) package:
2727
2828``` r
29- # install.packages("devtools")
30- devtools :: install_github(" Enchufa2/RcppXPtrUtils" )
29+ remotes :: install_github(" Enchufa2/RcppXPtrUtils" )
3130```
3231
3332## Use case
@@ -86,12 +85,12 @@ microbenchmark::microbenchmark(
8685 execute_cpp(func_cpp , 1.5 )
8786)
8887# > Unit: microseconds
89- # > expr min lq mean median uq
90- # > execute_r(func_r, 1.5) 14371.06 16081.805 17159.7910 16887.638 18066.667
91- # > execute_cpp(func_cpp, 1.5) 206.18 218.306 281.4874 232.214 268.673
88+ # > expr min lq mean median uq
89+ # > execute_r(func_r, 1.5) 14910.161 16261.928 17628.8078 17468.1140 18635.388
90+ # > execute_cpp(func_cpp, 1.5) 213.123 223.125 310.2708 237.0265 279.808
9291# > max neval cld
93- # > 22969.213 100 b
94- # > 2432.279 100 a
92+ # > 22657.568 100 b
93+ # > 2417.878 100 a
9594```
9695
9796The object returned by ` cppXPtr() ` is just an ` externalptr ` wrapped into
@@ -103,7 +102,7 @@ signatures in order to avoid runtime errors. This can be done with the
103102
104103``` r
105104func_cpp
106- # > 'SEXP foo(int n, double l)' <pointer: 0x5636b1e8a840 >
105+ # > 'SEXP foo(int n, double l)' <pointer: 0x55909eb28830 >
107106checkXPtr(func_cpp , " SEXP" , c(" int" , " double" )) # returns silently
108107checkXPtr(func_cpp , " int" , c(" int" , " double" ))
109108# > Error in checkXPtr(func_cpp, "int", c("int", "double")): Bad XPtr signature:
0 commit comments