6
6
[ ![ Build
7
7
Status] ( https://github.com/Enchufa2/RcppXPtrUtils/actions/workflows/build.yml/badge.svg )] ( https://github.com/Enchufa2/RcppXPtrUtils/actions/workflows/build.yml )
8
8
[ ![ 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 )
10
10
[ ![ CRAN_Status_Badge] ( https://www.r-pkg.org/badges/version/RcppXPtrUtils )] ( https://cran.r-project.org/package=RcppXPtrUtils )
11
11
[ ![ Downloads] ( https://cranlogs.r-pkg.org/badges/RcppXPtrUtils )] ( https://cran.r-project.org/package=RcppXPtrUtils )
12
12
@@ -22,12 +22,11 @@ Install the release version from CRAN:
22
22
install.packages(" RcppXPtrUtils" )
23
23
```
24
24
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:
27
27
28
28
``` r
29
- # install.packages("devtools")
30
- devtools :: install_github(" Enchufa2/RcppXPtrUtils" )
29
+ remotes :: install_github(" Enchufa2/RcppXPtrUtils" )
31
30
```
32
31
33
32
## Use case
@@ -86,12 +85,12 @@ microbenchmark::microbenchmark(
86
85
execute_cpp(func_cpp , 1.5 )
87
86
)
88
87
# > 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
92
91
# > max neval cld
93
- # > 22969.213 100 b
94
- # > 2432.279 100 a
92
+ # > 22657.568 100 b
93
+ # > 2417.878 100 a
95
94
```
96
95
97
96
The 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
103
102
104
103
``` r
105
104
func_cpp
106
- # > 'SEXP foo(int n, double l)' <pointer: 0x5636b1e8a840 >
105
+ # > 'SEXP foo(int n, double l)' <pointer: 0x55909eb28830 >
107
106
checkXPtr(func_cpp , " SEXP" , c(" int" , " double" )) # returns silently
108
107
checkXPtr(func_cpp , " int" , c(" int" , " double" ))
109
108
# > Error in checkXPtr(func_cpp, "int", c("int", "double")): Bad XPtr signature:
0 commit comments