The R Project SVN R

Rev

Rev 63173 | Rev 63202 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 63173 Rev 63178
Line 1... Line 1...
1
 
1
 
2
R Under development (unstable) (2013-07-04 r63172) -- "Unsuffered Consequences"
2
R Under development (unstable) (2013-07-04 r63177) -- "Unsuffered Consequences"
3
Copyright (C) 2013 The R Foundation for Statistical Computing
3
Copyright (C) 2013 The R Foundation for Statistical Computing
4
Platform: x86_64-unknown-linux-gnu (64-bit)
4
Platform: x86_64-unknown-linux-gnu (64-bit)
5
 
5
 
6
R is free software and comes with ABSOLUTELY NO WARRANTY.
6
R is free software and comes with ABSOLUTELY NO WARRANTY.
7
You are welcome to redistribute it under certain conditions.
7
You are welcome to redistribute it under certain conditions.
Line 98... Line 98...
98
[1] "* "
98
[1] "* "
99
 
99
 
100
$enumFormat
100
$enumFormat
101
function (n) 
101
function (n) 
102
sprintf("%d. ", n)
102
sprintf("%d. ", n)
103
<environment: 0x2853b10>
103
<environment: 0x2ecf050>
104
 
104
 
105
$showURLs
105
$showURLs
106
[1] FALSE
106
[1] FALSE
107
 
107
 
108
$code_quote
108
$code_quote
Line 132... Line 132...
132
[1] "* "
132
[1] "* "
133
 
133
 
134
$enumFormat
134
$enumFormat
135
function (n) 
135
function (n) 
136
sprintf("%d. ", n)
136
sprintf("%d. ", n)
137
<environment: 0x2853b10>
137
<environment: 0x2ecf050>
138
 
138
 
139
$showURLs
139
$showURLs
140
[1] FALSE
140
[1] FALSE
141
 
141
 
142
$code_quote
142
$code_quote
Line 166... Line 166...
166
[1] "* "
166
[1] "* "
167
 
167
 
168
$enumFormat
168
$enumFormat
169
function (n) 
169
function (n) 
170
sprintf("%d. ", n)
170
sprintf("%d. ", n)
171
<environment: 0x2853b10>
171
<environment: 0x2ecf050>
172
 
172
 
173
$showURLs
173
$showURLs
174
[1] FALSE
174
[1] FALSE
175
 
175
 
176
$code_quote
176
$code_quote
Line 219... Line 219...
219
> try( assertCondition(sqrt("abc"), "warning") )# -> error: had no warning
219
> try( assertCondition(sqrt("abc"), "warning") )# -> error: had no warning
220
Error in assertCondition(sqrt("abc"), "warning") : 
220
Error in assertCondition(sqrt("abc"), "warning") : 
221
  Got simpleError (non-numeric argument to mathematical function) in evaluating sqrt("abc"); expected warning
221
  Got simpleError (non-numeric argument to mathematical function) in evaluating sqrt("abc"); expected warning
222
> ## verbose ==> show error message additionally:
222
> ## verbose ==> show error message additionally:
223
>      assertCondition(sqrt("abc"), verbose=TRUE, "error")
223
>      assertCondition(sqrt("abc"), verbose=TRUE, "error")
224
Asserted error : non-numeric argument to mathematical function
224
Asserted error: non-numeric argument to mathematical function
225
> 
225
> 
226
> assertCondition(matrix(1:5, 2,3), "warning")
226
> assertCondition(matrix(1:5, 2,3), "warning")
227
> try( assertCondition(matrix(1:8, 4,3), "error") )
227
> try( assertCondition(matrix(1:8, 4,3), "error") )
228
Error in assertCondition(matrix(1:8, 4, 3), "error") : 
228
Error in assertCondition(matrix(1:8, 4, 3), "error") : 
229
  Got simpleWarning (data length [8] is not a sub-multiple or multiple of the number of columns [3]) in evaluating matrix(1:8, 4, 3); expected error
229
  Got simpleWarning (data length [8] is not a sub-multiple or multiple of the number of columns [3]) in evaluating matrix(1:8, 4, 3); expected error
230
> ## .. Failed to get expected error ....
230
> ## .. Failed to get expected error ....
231
> 
231
> 
232
> ## either warning or worse:
232
> ## either warning or worse:
233
> assertCondition(matrix(1:8, 4,3), verbose=TRUE, "error","warning") # OK
233
> assertCondition(matrix(1:8, 4,3), verbose=TRUE, "error","warning") # OK
234
Asserted warning : data length [8] is not a sub-multiple or multiple of the number of columns [3]
234
Asserted warning: data length [8] is not a sub-multiple or multiple of the number of columns [3]
235
> assertCondition(matrix(1:8, 4, 3), "warning", "error") # ditto
235
> assertCondition(matrix(1:8, 4, 3), "warning", "error") # ditto
236
> 
236
> 
237
> ## when both are signalled:
237
> ## when both are signalled:
238
> ff <- function() { warning("my warning"); stop("my error") }
238
> ff <- function() { warning("my warning"); stop("my error") }
239
>     assertCondition(ff(), "warning")
239
>     assertCondition(ff(), "warning")
Line 243... Line 243...
243
> ## assert that assertC..() does not assert [and use *one* argument only]
243
> ## assert that assertC..() does not assert [and use *one* argument only]
244
> assertCondition( assertCondition(sqrt( 2   ), "warning") )
244
> assertCondition( assertCondition(sqrt( 2   ), "warning") )
245
> assertCondition( assertCondition(sqrt("abc"), "warning"), "error")
245
> assertCondition( assertCondition(sqrt("abc"), "warning"), "error")
246
> assertCondition( assertCondition(matrix(1:8, 4,3), "error"),
246
> assertCondition( assertCondition(matrix(1:8, 4,3), "error"),
247
+                 "error", verbose=TRUE)
247
+                 "error", verbose=TRUE)
248
Asserted error : Got simpleWarning (data length [8] is not a sub-multiple or multiple of the number of columns [3]) in evaluating matrix(1:8, 4, 3); expected error
248
Asserted error: Got simpleWarning (data length [8] is not a sub-multiple or multiple of the number of columns [3]) in evaluating matrix(1:8, 4, 3); expected error
249
> 
249
> 
250
> 
250
> 
251
> 
251
> 
252
> cleanEx()
252
> cleanEx()
253
> nameEx("bibstyle")
253
> nameEx("bibstyle")
Line 283... Line 283...
283
+     pages = "211-252"))
283
+     pages = "211-252"))
284
> 
284
> 
285
> bibstyle("unsorted", sortKeys = function(refs) seq_along(refs),
285
> bibstyle("unsorted", sortKeys = function(refs) seq_along(refs),
286
+     fmtPrefix = function(paper) paste0("[", paper$.index, "]"),
286
+     fmtPrefix = function(paper) paste0("[", paper$.index, "]"),
287
+        .init = TRUE)
287
+        .init = TRUE)
288
<environment: 0x2d8adf8>
288
<environment: 0x3406378>
289
> print(refs, .bibstyle = "unsorted")
289
> print(refs, .bibstyle = "unsorted")
290
[1] R Core Team (2013). _R: A Language and Environment for Statistical
290
[1] R Core Team (2013). _R: A Language and Environment for Statistical
291
Computing_. R Foundation for Statistical Computing, Vienna, Austria.
291
Computing_. R Foundation for Statistical Computing, Vienna, Austria.
292
<URL: http://www.R-project.org>.
292
<URL: http://www.R-project.org>.
293
 
293
 
Line 1031... Line 1031...
1031
> 
1031
> 
1032
> ### * <FOOTER>
1032
> ### * <FOOTER>
1033
> ###
1033
> ###
1034
> options(digits = 7L)
1034
> options(digits = 7L)
1035
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
1035
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
1036
Time elapsed:  0.474 0.026 0.639 0 0 
1036
Time elapsed:  0.471 0.023 0.593 0 0 
1037
> grDevices::dev.off()
1037
> grDevices::dev.off()
1038
null device 
1038
null device 
1039
          1 
1039
          1 
1040
> ###
1040
> ###
1041
> ### Local variables: ***
1041
> ### Local variables: ***