@@ -104,7 +104,7 @@ The goal of the function \texttt{foo} code is simple. Given two
104
104
105
105
<<eval =FALSE >>=
106
106
foo <- function (x , y ){
107
- ifelse( x < y , x * x , - (y * y ) )
107
+ ifelse( x < y , x * x , - (y * y ) )
108
108
}
109
109
@
110
110
@@ -218,7 +218,6 @@ NumericVector res = -x ;
218
218
// use it as part of a numerical expression
219
219
NumericVector res = - x * ( x + 2.0 ) ;
220
220
221
-
222
221
// two integer vectors of the same size
223
222
NumericVector y ;
224
223
NumericVector z ;
@@ -243,7 +242,6 @@ given a logical sugar expression.
243
242
<<lang =cpp >>=
244
243
IntegerVector x = seq_len( 1000 ) ;
245
244
all( x * x < 3 ) ;
246
-
247
245
any( x * x < 3 ) ;
248
246
@
249
247
@@ -448,7 +446,7 @@ pow(x, z) # x to the power of z
448
446
449
447
% log() and log10() maybe? Or ln() ?
450
448
451
- \subsection {The d/q/p/q statistical functions }
449
+ \subsection {The d/q/p/r statistical functions }
452
450
453
451
The framework provided by \sugar also permits easy and efficient access the
454
452
density, distribution function, quantile and random number generation
@@ -460,8 +458,8 @@ would in \proglang{R}:
460
458
461
459
<<lang =cpp >>=
462
460
x1 = dnorm(y1 , 0 , 1 ); // density of y1 at m = 0 , sd = 1
463
- x2 = pnorm (y2 , 0 , 1 ); // distribution function of y2
464
- x3 = qnorm (y3 , 0 , 1 ); // quantiles of y3
461
+ x2 = qnorm (y2 , 0 , 1 ); // quantiles of y2
462
+ x3 = pnorm (y3 , 0 , 1 ); // distribution function of y3
465
463
x4 = rnorm(n , 0 , 1 ); // ' n' RNG draws of N(0 , 1 )
466
464
@
467
465
0 commit comments