Skip to content

Commit 77b031f

Browse files
committed
first set of '/usr/bin/env r' changes
1 parent fa58dc2 commit 77b031f

File tree

7 files changed

+23
-9
lines changed

7 files changed

+23
-9
lines changed

ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2016-02-21 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/examples/functionCallback/newApiExample.r (vecfunc): Switched to
4+
using '/usr/bin/env r', switch to using 'cxxfunction'
5+
6+
* inst/examples/Misc/fibonacci.r: Switched to using '/usr/bin/env r',
7+
added explicit load of Rcpp package
8+
9+
* inst/examples/Misc/newFib.r: Switched to using '/usr/bin/env r'
10+
* inst/examples/Misc/ifelseLooped.r: Idem
11+
* inst/examples/Misc/piBySimulation.r: Idem
12+
* inst/examples/SugarPerformance/sugarBenchmarks.r: Idem
13+
114
2016-02-16 Dirk Eddelbuettel <[email protected]>
215

316
* vignettes/Rcpp-FAQ.Rnw: Added answer on fixed-size limit of arguments

inst/examples/Misc/fibonacci.r

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
#!/usr/bin/r
1+
#!/usr/bin/env r
22

33
## this short example was provided in response to this StackOverflow questions:
44
## http://stackoverflow.com/questions/6807068/why-is-my-recursive-function-so-slow-in-r
55
## and illustrates that recursive function calls are a) really expensive in R and b) not
66
## all expensive in C++ (my machine sees a 700-fold speed increase) and c) the byte
77
## compiler in R does not help here.
88

9+
suppressMessages(library(Rcpp))
10+
911
## byte compiler
1012
require(compiler)
1113

inst/examples/Misc/ifelseLooped.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/r
1+
#!/usr/bin/env r
22
##
33
## This example goes back to the following StackOverflow questions:
44
## http://stackoverflow.com/questions/7153586/can-i-vectorize-a-calculation-which-depends-on-previous-elements

inst/examples/Misc/newFib.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/r
1+
#!/usr/bin/env r
22

33
## New and shorter version of Fibonacci example using Rcpp 0.9.16 or later features
44
## The the sibbling file 'fibonacci.r' for context

inst/examples/Misc/piBySimulation.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/r
1+
#!/usr/bin/env r
22

33
library(Rcpp)
44
library(rbenchmark)

inst/examples/SugarPerformance/sugarBenchmarks.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/r -t
1+
#!/usr/bin/env r
22

33
suppressMessages(library(inline))
44
suppressMessages(library(Rcpp))

inst/examples/functionCallback/newApiExample.r

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/r -ti
1+
#!/usr/bin/env r
22

33
suppressMessages(library(Rcpp))
44
suppressMessages(library(inline))
@@ -24,8 +24,8 @@ cpp <- '
2424
'
2525

2626
# create a C++ function
27-
funx <- cfunction(signature(N = "integer" , xvec = "numeric", fun = "function" ),
28-
cpp, , Rcpp = TRUE, include = "using namespace Rcpp; ")
27+
funx <- cxxfunction(signature(N = "integer" , xvec = "numeric", fun = "function" ),
28+
body=cpp, include = "using namespace Rcpp; ", plugin = "Rcpp")
2929

3030
# create the vector
3131
xvec <- sqrt(c(1:12, 11:1))
@@ -36,4 +36,3 @@ par(mar=c(3,3,1,1),cex=0.8, pch=19)
3636

3737
# run example
3838
funx( 10L, xvec, vecfunc )
39-

0 commit comments

Comments
 (0)