The R Project SVN R

Rev

Rev 90045 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
56186 murdoch 1
 
88966 maechler 2
R Under development (unstable) (2025-10-22 r88964) -- "Unsuffered Consequences"
87983 hornik 3
Copyright (C) 2025 The R Foundation for Statistical Computing
86901 maechler 4
Platform: x86_64-pc-linux-gnu
56186 murdoch 5
 
6
R is free software and comes with ABSOLUTELY NO WARRANTY.
7
You are welcome to redistribute it under certain conditions.
8
Type 'license()' or 'licence()' for distribution details.
9
 
10
R is a collaborative project with many contributors.
11
Type 'contributors()' for more information and
12
'citation()' on how to cite R or R packages in publications.
13
 
14
Type 'demo()' for some demos, 'help()' for on-line help, or
15
'help.start()' for an HTML browser interface to help.
16
Type 'q()' to quit R.
17
 
18
> pkgname <- "tools"
19
> source(file.path(R.home("share"), "R", "examples-header.R"))
20
> options(warn = 1)
21
> library('tools')
22
> 
61787 ripley 23
> base::assign(".oldSearch", base::search(), pos = 'CheckExEnv')
73819 hornik 24
> base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv')
56186 murdoch 25
> cleanEx()
71818 hornik 26
> nameEx("CRANtools")
27
> ### * CRANtools
28
> 
29
> flush(stderr()); flush(stdout())
30
> 
31
> ### Name: CRANtools
32
> ### Title: CRAN Package Repository Tools
33
> ### Aliases: CRAN_package_db CRAN_check_results CRAN_check_details
82421 ripley 34
> ###   CRAN_check_issues summarize_CRAN_check_status R_CRAN_WEB R_CRAN_SRC
86940 hornik 35
> ###   CRAN_current_db CRAN_aliases_db CRAN_rdxrefs_db CRAN_archive_db
87038 hornik 36
> ###   CRAN_authors_db
71818 hornik 37
> 
38
> ### ** Examples
39
> 
40
> 
41
> cleanEx()
56186 murdoch 42
> nameEx("HTMLheader")
43
> ### * HTMLheader
44
> 
45
> flush(stderr()); flush(stdout())
46
> 
47
> ### Name: HTMLheader
73574 hornik 48
> ### Title: Generate a Standard HTML Header for R Help
56186 murdoch 49
> ### Aliases: HTMLheader
50
> ### Keywords: utilities documentation
51
> 
52
> ### ** Examples
53
> 
54
> cat(HTMLheader("This is a sample header"), sep="\n")
81689 hornik 55
<!DOCTYPE html>
56
<html>
66083 ripley 57
<head><title>R: This is a sample header</title>
88673 hornik 58
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
59
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
60
<link rel="stylesheet" type="text/css" href="/doc/html/R.css">
80268 deepayan 61
</head><body><div class="container">
56186 murdoch 62
<h1> This is a sample header
88673 hornik 63
<img class="toplogo" src="/doc/html/Rlogo.svg" alt="[R logo]">
56186 murdoch 64
</h1>
88673 hornik 65
<hr>
66083 ripley 66
<div style="text-align: center;">
88673 hornik 67
<a href="/doc/html/index.html"><img class="arrow" src="/doc/html/up.jpg" alt="[Top]"></a>
56186 murdoch 68
</div>
69
> 
70
> 
71
> 
72
> cleanEx()
86951 hornik 73
> nameEx("R")
74
> ### * R
75
> 
76
> flush(stderr()); flush(stdout())
77
> 
78
> ### Name: R
79
> ### Title: Call Function in Inferior R Process
80
> ### Aliases: R
81
> 
82
> ### ** Examples
83
> 
84
> ## Compute cos(0) in an inferior R process.
85
> ## By default, only return the value of the function call.
86
> R(cos, list(0))
87
[1] 1
88
> ## If 'drop = FALSE', we also get status, stdout and stderr.
86957 hornik 89
> ## IGNORE_RDIFF_BEGIN
86951 hornik 90
> R(cos, list(0), drop = FALSE)
91
$value
92
[1] 1
93
 
94
$status
95
[1] 0
96
 
97
$stdout
98
 [1] ""                                                                                 
88966 maechler 99
 [2] "R Under development (unstable) (2025-10-22 r88964) -- \"Unsuffered Consequences\""
87983 hornik 100
 [3] "Copyright (C) 2025 The R Foundation for Statistical Computing"                    
86951 hornik 101
 [4] "Platform: x86_64-pc-linux-gnu"                                                    
102
 [5] ""                                                                                 
103
 [6] "R is free software and comes with ABSOLUTELY NO WARRANTY."                        
104
 [7] "You are welcome to redistribute it under certain conditions."                     
105
 [8] "Type 'license()' or 'licence()' for distribution details."                        
106
 [9] ""                                                                                 
107
[10] "R is a collaborative project with many contributors."                             
108
[11] "Type 'contributors()' for more information and"                                   
109
[12] "'citation()' on how to cite R or R packages in publications."                     
110
[13] ""                                                                                 
111
[14] "Type 'demo()' for some demos, 'help()' for on-line help, or"                      
112
[15] "'help.start()' for an HTML browser interface to help."                            
113
[16] "Type 'q()' to quit R."                                                            
114
[17] ""                                                                                 
88727 hornik 115
[18] "> x <- readRDS(\"/tmp/RtmpjrnqE8/runri2309077fd2bc56\")"                          
86951 hornik 116
[19] "> options(repos = x$repos)"                                                       
117
[20] "> y <- tryCatch(list(do.call(x$fun, x$args, quote = TRUE)), error = identity)"    
88727 hornik 118
[21] "> saveRDS(y, \"/tmp/RtmpjrnqE8/runro230907d287351\")"                             
86951 hornik 119
[22] "> "                                                                               
120
 
121
$stderr
122
character(0)
123
 
86957 hornik 124
> ## IGNORE_RDIFF_END
86959 hornik 125
>     
86951 hornik 126
> 
127
> ## A call giving an error:
128
> (e <- tryCatch(R(stop, list("FOOBAR")), error = identity))
129
<inferiorCallError: error in inferior call:
130
  FOOBAR>
131
> ## The inferior R process ran successfully:
132
> e$status
133
[1] 0
134
> ## The function call gave an error:
135
> e$value
136
<simpleError in do.call(x$fun, x$args, quote = TRUE): FOOBAR>
137
> 
138
> 
139
> 
140
> cleanEx()
56186 murdoch 141
> nameEx("Rd2HTML")
142
> ### * Rd2HTML
143
> 
144
> flush(stderr()); flush(stdout())
145
> 
146
> ### Name: Rd2HTML
147
> ### Title: Rd Converters
148
> ### Aliases: Rd2txt Rd2HTML Rd2ex Rd2latex
149
> ### Keywords: documentation
150
> 
151
> ### ** Examples
86027 smeyer 152
> 
153
> 
56186 murdoch 154
> cleanEx()
155
> nameEx("Rd2txt_options")
156
> ### * Rd2txt_options
157
> 
158
> flush(stderr()); flush(stdout())
159
> 
160
> ### Name: Rd2txt_options
73574 hornik 161
> ### Title: Set Formatting Options for Text Help
56186 murdoch 162
> ### Aliases: Rd2txt_options
163
> ### Keywords: documentation
164
> 
165
> ### ** Examples
166
> 
86027 smeyer 167
> saveOpts <- Rd2txt_options()
168
> Rd2txt_options(minIndent = 4)
169
> Rd2txt_options()[["minIndent"]]
170
[1] 4
171
> Rd2txt_options(saveOpts)
172
> stopifnot(identical(Rd2txt_options(), saveOpts))
56186 murdoch 173
> 
174
> 
175
> 
176
> cleanEx()
177
> nameEx("Rdutils")
178
> ### * Rdutils
179
> 
180
> flush(stderr()); flush(stdout())
181
> 
182
> ### Name: Rdutils
183
> ### Title: Rd Utilities
184
> ### Aliases: Rd_db
185
> ### Keywords: utilities documentation
186
> 
187
> ### ** Examples
188
> 
189
> 
190
> cleanEx()
63062 maechler 191
> nameEx("assertCondition")
192
> ### * assertCondition
193
> 
194
> flush(stderr()); flush(stdout())
195
> 
196
> ### Name: assertCondition
197
> ### Title: Asserting Error Conditions
63202 ripley 198
> ### Aliases: assertCondition assertWarning assertError
63062 maechler 199
> ### Keywords: programming error
200
> 
201
> ### ** Examples
202
> 
63202 ripley 203
>   assertError(sqrt("abc"))
204
>   assertWarning(matrix(1:8, 4,3))
63062 maechler 205
> 
63202 ripley 206
>   assertCondition( ""-1 ) # ok, any condition would satisfy this
207
> 
63062 maechler 208
> try( assertCondition(sqrt(2), "warning") )
209
Error in assertCondition(sqrt(2), "warning") : 
63202 ripley 210
  Failed to get warning in evaluating sqrt(2)
211
> ## .. Failed to get warning in evaluating sqrt(2)
63062 maechler 212
>      assertCondition(sqrt("abc"), "error")   # ok
213
> try( assertCondition(sqrt("abc"), "warning") )# -> error: had no warning
214
Error in assertCondition(sqrt("abc"), "warning") : 
63202 ripley 215
  Got simpleError in evaluating sqrt("abc"); wanted warning
63623 ripley 216
>      assertCondition(sqrt("abc"), "error")
63202 ripley 217
>   ## identical to assertError() call above
63062 maechler 218
> 
63146 maechler 219
> assertCondition(matrix(1:5, 2,3), "warning")
63062 maechler 220
> try( assertCondition(matrix(1:8, 4,3), "error") )
221
Error in assertCondition(matrix(1:8, 4, 3), "error") : 
63202 ripley 222
  Got simpleWarning in evaluating matrix(1:8, 4, 3); wanted error
63146 maechler 223
> ## .. Failed to get expected error ....
63062 maechler 224
> 
225
> ## either warning or worse:
63202 ripley 226
> assertCondition(matrix(1:8, 4,3), "error","warning") # OK
63623 ripley 227
> assertCondition(matrix(1:8, 4, 3), "warning") # OK
63062 maechler 228
> 
63146 maechler 229
> ## when both are signalled:
230
> ff <- function() { warning("my warning"); stop("my error") }
231
>     assertCondition(ff(), "warning")
63202 ripley 232
> ## but assertWarning does not allow an error to follow
233
> try(assertWarning(ff()))
234
Error in assertWarning(ff()) : 
235
  Got warning in evaluating ff(), but also an error
63173 maechler 236
>     assertCondition(ff(), "error")          # ok
63146 maechler 237
> assertCondition(ff(), "error", "warning") # ok (quietly, catching warning)
63062 maechler 238
> 
63173 maechler 239
> ## assert that assertC..() does not assert [and use *one* argument only]
240
> assertCondition( assertCondition(sqrt( 2   ), "warning") )
241
> assertCondition( assertCondition(sqrt("abc"), "warning"), "error")
242
> assertCondition( assertCondition(matrix(1:8, 4,3), "error"),
63202 ripley 243
+                 "error")
63062 maechler 244
> 
63146 maechler 245
> 
63173 maechler 246
> 
63062 maechler 247
> cleanEx()
56186 murdoch 248
> nameEx("bibstyle")
249
> ### * bibstyle
250
> 
251
> flush(stderr()); flush(stdout())
252
> 
253
> ### Name: bibstyle
73574 hornik 254
> ### Title: Select or Define a Bibliography Style
59584 ripley 255
> ### Aliases: bibstyle getBibstyle
86517 smeyer 256
> ### Keywords: utilities documentation
56186 murdoch 257
> 
258
> ### ** Examples
259
> 
61435 ripley 260
> refs <-
56186 murdoch 261
+ c(bibentry(bibtype = "manual",
262
+     title = "R: A Language and Environment for Statistical Computing",
59036 ripley 263
+     author = person("R Core Team"),
56186 murdoch 264
+     organization = "R Foundation for Statistical Computing",
265
+     address = "Vienna, Austria",
62216 ripley 266
+     year = 2013,
68955 ripley 267
+     url = "https://www.R-project.org"),
56186 murdoch 268
+   bibentry(bibtype = "article",
88727 hornik 269
+     author = c(person(c("George", "Edward", "Pelham"), "Box"),
270
+                person(c("David",  "Roxbee"), "Cox")),
56186 murdoch 271
+     year = 1964,
56281 ripley 272
+     title = "An Analysis of Transformations",
273
+     journal = "Journal of the Royal Statistical Society, Series B",
82011 smeyer 274
+     volume = 26, number = 2, pages = "211--243",
275
+     doi = "10.1111/j.2517-6161.1964.tb00553.x"))
61435 ripley 276
> 
56281 ripley 277
> bibstyle("unsorted", sortKeys = function(refs) seq_along(refs),
59618 ripley 278
+     fmtPrefix = function(paper) paste0("[", paper$.index, "]"),
56281 ripley 279
+        .init = TRUE)
88727 hornik 280
<environment: 0x55a759bc34c8>
61435 ripley 281
> print(refs, .bibstyle = "unsorted")
62216 ripley 282
[1] R Core Team (2013). _R: A Language and Environment for Statistical
59036 ripley 283
Computing_. R Foundation for Statistical Computing, Vienna, Austria.
82118 smeyer 284
<https://www.R-project.org>.
56186 murdoch 285
 
88556 smeyer 286
[2] Box GEP, Cox DR (1964). “An Analysis of Transformations.” _Journal
90045 smeyer 287
of the Royal Statistical Society, Series B_, *26*(2), 211–243.
82121 smeyer 288
doi:10.1111/j.2517-6161.1964.tb00553.x
289
<https://doi.org/10.1111/j.2517-6161.1964.tb00553.x>.
56186 murdoch 290
> 
291
> 
292
> 
293
> cleanEx()
65417 ripley 294
> nameEx("buildVignettes")
295
> ### * buildVignettes
296
> 
297
> flush(stderr()); flush(stdout())
298
> 
299
> ### Name: buildVignettes
300
> ### Title: List and Build Package Vignettes
301
> ### Aliases: buildVignettes pkgVignettes
302
> ### Keywords: utilities documentation
303
> 
304
> ### ** Examples
305
> 
65450 maechler 306
> gVigns <- pkgVignettes("grid")
65417 ripley 307
> 
308
> 
309
> 
310
> cleanEx()
56186 murdoch 311
> nameEx("charsets")
312
> ### * charsets
313
> 
314
> flush(stderr()); flush(stdout())
315
> 
316
> ### Name: charsets
317
> ### Title: Conversion Tables between Character Sets
318
> ### Aliases: Adobe_glyphs charset_to_Unicode
319
> ### Keywords: datasets
320
> 
321
> ### ** Examples
322
> 
323
> ## find Adobe names for ISOLatin2 chars.
324
> latin2 <- charset_to_Unicode[, "ISOLatin2"]
78669 ripley 325
> aUnicode <- as.hexmode(paste0("0x", Adobe_glyphs$unicode))
56186 murdoch 326
> keep <- aUnicode %in% latin2
327
> aUnicode <- aUnicode[keep]
328
> aAdobe <- Adobe_glyphs[keep, 1]
329
> ## first match
330
> aLatin2 <- aAdobe[match(latin2, aUnicode)]
331
> ## all matches
332
> bLatin2 <- lapply(1:256, function(x) aAdobe[aUnicode == latin2[x]])
61161 ripley 333
> format(bLatin2, justify = "none")
56186 murdoch 334
  [1] ""                          "controlSTX"               
335
  [3] "controlSOT"                "controlETX"               
336
  [5] "controlEOT"                "controlENQ"               
337
  [7] "controlACK"                "controlBEL"               
338
  [9] "controlBS"                 "controlHT"                
339
 [11] "controlLF"                 "controlVT"                
340
 [13] "controlFF"                 "controlCR"                
341
 [15] "controlSO"                 "controlSI"                
342
 [17] "controlDLE"                "controlDC1"               
343
 [19] "controlDC2"                "controlDC3"               
344
 [21] "controlDC4"                "controlNAK"               
345
 [23] "controlSYN"                "controlETB"               
346
 [25] "controlCAN"                "controlEM"                
347
 [27] "controlSUB"                "controlESC"               
348
 [29] "controlFS"                 "controlGS"                
349
 [31] "controlRS"                 "controlUS"                
350
 [33] "space, spacehackarabic"    "exclam"                   
351
 [35] "quotedbl"                  "numbersign"               
352
 [37] "dollar"                    "percent"                  
353
 [39] "ampersand"                 "quotesingle"              
354
 [41] "parenleft"                 "parenright"               
355
 [43] "asterisk"                  "plus"                     
356
 [45] "comma"                     "hyphen"                   
357
 [47] "period"                    "slash"                    
358
 [49] "zero"                      "one"                      
359
 [51] "two"                       "three"                    
360
 [53] "four"                      "five"                     
361
 [55] "six"                       "seven"                    
362
 [57] "eight"                     "nine"                     
363
 [59] "colon"                     "semicolon"                
364
 [61] "less"                      "equal"                    
365
 [63] "greater"                   "question"                 
366
 [65] "at"                        "A"                        
367
 [67] "B"                         "C"                        
368
 [69] "D"                         "E"                        
369
 [71] "F"                         "G"                        
370
 [73] "H"                         "I"                        
371
 [75] "J"                         "K"                        
372
 [77] "L"                         "M"                        
373
 [79] "N"                         "O"                        
374
 [81] "P"                         "Q"                        
375
 [83] "R"                         "S"                        
376
 [85] "T"                         "U"                        
377
 [87] "V"                         "W"                        
378
 [89] "X"                         "Y"                        
379
 [91] "Z"                         "bracketleft"              
380
 [93] "backslash"                 "bracketright"             
381
 [95] "asciicircum"               "underscore"               
382
 [97] "grave"                     "a"                        
383
 [99] "b"                         "c"                        
384
[101] "d"                         "e"                        
385
[103] "f"                         "g"                        
386
[105] "h"                         "i"                        
387
[107] "j"                         "k"                        
388
[109] "l"                         "m"                        
389
[111] "n"                         "o"                        
390
[113] "p"                         "q"                        
391
[115] "r"                         "s"                        
392
[117] "t"                         "u"                        
393
[119] "v"                         "w"                        
394
[121] "x"                         "y"                        
395
[123] "z"                         "braceleft"                
396
[125] "bar, verticalbar"          "braceright"               
397
[127] "asciitilde"                "controlDEL"               
398
[129] ""                          ""                         
399
[131] ""                          ""                         
400
[133] ""                          ""                         
401
[135] ""                          ""                         
402
[137] ""                          ""                         
403
[139] ""                          ""                         
404
[141] ""                          ""                         
405
[143] ""                          ""                         
406
[145] ""                          ""                         
407
[147] ""                          ""                         
408
[149] ""                          ""                         
409
[151] ""                          ""                         
410
[153] ""                          ""                         
411
[155] ""                          ""                         
412
[157] ""                          ""                         
413
[159] ""                          ""                         
414
[161] "nbspace, nonbreakingspace" "Aogonek"                  
415
[163] "breve"                     "Lslash"                   
416
[165] "currency"                  "Lcaron"                   
417
[167] "Sacute"                    "section"                  
418
[169] "dieresis"                  "Scaron"                   
419
[171] "Scedilla"                  "Tcaron"                   
420
[173] "Zacute"                    "sfthyphen, softhyphen"    
421
[175] "Zcaron"                    "Zdot, Zdotaccent"         
422
[177] "degree"                    "aogonek"                  
423
[179] "ogonek"                    "lslash"                   
424
[181] "acute"                     "lcaron"                   
425
[183] "sacute"                    "caron"                    
426
[185] "cedilla"                   "scaron"                   
427
[187] "scedilla"                  "tcaron"                   
428
[189] "zacute"                    "hungarumlaut"             
429
[191] "zcaron"                    "zdot, zdotaccent"         
430
[193] "Racute"                    "Aacute"                   
431
[195] "Acircumflex"               "Abreve"                   
432
[197] "Adieresis"                 "Lacute"                   
433
[199] "Cacute"                    "Ccedilla"                 
434
[201] "Ccaron"                    "Eacute"                   
435
[203] "Eogonek"                   "Edieresis"                
436
[205] "Ecaron"                    "Iacute"                   
437
[207] "Icircumflex"               "Dcaron"                   
438
[209] "Dcroat, Dslash"            "Nacute"                   
439
[211] "Ncaron"                    "Oacute"                   
440
[213] "Ocircumflex"               "Odblacute, Ohungarumlaut" 
441
[215] "Odieresis"                 "multiply"                 
442
[217] "Rcaron"                    "Uring"                    
443
[219] "Uacute"                    "Udblacute, Uhungarumlaut" 
444
[221] "Udieresis"                 "Yacute"                   
445
[223] "Tcedilla, Tcommaaccent"    "germandbls"               
446
[225] "racute"                    "aacute"                   
447
[227] "acircumflex"               "abreve"                   
448
[229] "adieresis"                 "lacute"                   
449
[231] "cacute"                    "ccedilla"                 
450
[233] "ccaron"                    "eacute"                   
451
[235] "eogonek"                   "edieresis"                
452
[237] "ecaron"                    "iacute"                   
453
[239] "icircumflex"               "dcaron"                   
454
[241] "dcroat, dmacron"           "nacute"                   
455
[243] "ncaron"                    "oacute"                   
456
[245] "ocircumflex"               "odblacute, ohungarumlaut" 
457
[247] "odieresis"                 "divide"                   
458
[249] "rcaron"                    "uring"                    
459
[251] "uacute"                    "udblacute, uhungarumlaut" 
460
[253] "udieresis"                 "yacute"                   
461
[255] "tcedilla, tcommaaccent"    "dotaccent"                
462
> 
463
> 
464
> 
465
> cleanEx()
466
> nameEx("checkFF")
467
> ### * checkFF
468
> 
469
> flush(stderr()); flush(stdout())
470
> 
471
> ### Name: checkFF
472
> ### Title: Check Foreign Function Calls
473
> ### Aliases: checkFF print.checkFF
474
> ### Keywords: programming utilities
475
> 
476
> ### ** Examples
477
> 
478
> 
479
> cleanEx()
59221 ripley 480
> nameEx("checkPoFiles")
481
> ### * checkPoFiles
482
> 
483
> flush(stderr()); flush(stdout())
484
> 
485
> ### Name: checkPoFiles
73574 hornik 486
> ### Title: Check Translation Files for Inconsistent Format Strings
59221 ripley 487
> ### Aliases: checkPoFile checkPoFiles
488
> ### Keywords: utilities
489
> 
490
> ### ** Examples
491
> 
492
> ## Not run: 
493
> ##D checkPoFiles("de", "/path/to/R/src/directory")
494
> ## End(Not run)
495
> 
496
> 
497
> 
498
> cleanEx()
85032 smeyer 499
> nameEx("checkRd")
500
> ### * checkRd
501
> 
502
> flush(stderr()); flush(stdout())
503
> 
504
> ### Name: checkRd
505
> ### Title: Check an Rd Object
506
> ### Aliases: checkRd
507
> ### Keywords: utilities documentation
508
> 
509
> ### ** Examples
510
> 
511
> ## parsed Rd from the installed version of _this_ help file
512
> rd <- Rd_db("tools")[["checkRd.Rd"]]
513
> stopifnot(length(checkRd(rd)) == 0)  # there should be no issues
514
> 
515
> ## make up \tabular issues
516
> bad <- r"(\name{bad}\title{bad}\description{\tabular{p}{1 \tab 2}})"
517
> (res <- checkRd(parse_Rd(textConnection(bad))))
518
checkRd: (7) <connection>:1: Unrecognized \tabular format: p
88966 maechler 519
checkRd: (7) <connection>:1: Only 1 column allowed in this table (row 1 has 2)
85032 smeyer 520
> stopifnot(length(res) > 0)
521
> 
522
> 
523
> 
524
> cleanEx()
56186 murdoch 525
> nameEx("checkRdaFiles")
526
> ### * checkRdaFiles
527
> 
528
> flush(stderr()); flush(stdout())
529
> 
530
> ### Name: checkRdaFiles
531
> ### Title: Report on Details of Saved Images or Re-saves them
532
> ### Aliases: checkRdaFiles resaveRdaFiles
533
> ### Keywords: utilities
534
> 
535
> ### ** Examples
536
> ## Not run: 
537
> ##D ## from a package top-level source directory
538
> ##D paths <- sort(Sys.glob(c("data/*.rda", "data/*.RData")))
539
> ##D (res <- checkRdaFiles(paths))
540
> ##D ## pick out some that may need attention
541
> ##D bad <- is.na(res$ASCII) | res$ASCII | (res$size > 1e4 & res$compress == "none")
542
> ##D res[bad, ]
543
> ## End(Not run)
544
> 
545
> 
546
> cleanEx()
66602 ripley 547
> nameEx("check_packages_in_dir")
548
> ### * check_packages_in_dir
549
> 
550
> flush(stderr()); flush(stdout())
551
> 
552
> ### Name: check_packages_in_dir
553
> ### Title: Check Source Packages and Their Reverse Dependencies
554
> ### Aliases: check_packages_in_dir summarize_check_packages_in_dir_depends
555
> ###   summarize_check_packages_in_dir_results
67274 ripley 556
> ###   summarize_check_packages_in_dir_timings check_packages_in_dir_changes
71818 hornik 557
> ###   check_packages_in_dir_details
66602 ripley 558
> ### Keywords: utilities
559
> 
560
> ### ** Examples
561
> 
562
> ## Not run: 
563
> ##D ## Check packages in dir without reverse dependencies:
564
> ##D check_packages_in_dir(dir)
565
> ##D ## Check packages in dir and their reverse dependencies using the
566
> ##D ## defaults (all repositories in getOption("repos"), all "strong"
567
> ##D ## reverse dependencies, no recursive reverse dependencies):
568
> ##D check_packages_in_dir(dir, reverse = list())
569
> ##D ## Check packages in dir with their reverse dependencies from CRAN,
570
> ##D ## using all strong reverse dependencies and reverse suggests:
571
> ##D check_packages_in_dir(dir,
572
> ##D                       reverse = list(repos = getOption("repos")["CRAN"],
573
> ##D                                      which = "most"))                   
574
> ##D ## Check packages in dir with their reverse dependencies from CRAN,
575
> ##D ## using '--as-cran' for the former but not the latter:
576
> ##D check_packages_in_dir(dir,
577
> ##D                       check_args = c("--as-cran", ""),
578
> ##D                       reverse = list(repos = getOption("repos")["CRAN"]))
579
> ## End(Not run)
580
> 
581
> 
582
> 
583
> cleanEx()
56186 murdoch 584
> nameEx("delimMatch")
585
> ### * delimMatch
586
> 
587
> flush(stderr()); flush(stdout())
588
> 
589
> ### Name: delimMatch
590
> ### Title: Delimited Pattern Matching
591
> ### Aliases: delimMatch
592
> ### Keywords: character
593
> 
594
> ### ** Examples
595
> 
596
> x <- c("\\value{foo}", "function(bar)")
597
> delimMatch(x)
598
[1]  7 -1
599
attr(,"match.length")
600
[1]  5 -1
601
> delimMatch(x, c("(", ")"))
602
[1] -1  9
603
attr(,"match.length")
604
[1] -1  5
605
> 
606
> 
607
> 
608
> cleanEx()
609
> nameEx("dependsOnPkgs")
610
> ### * dependsOnPkgs
611
> 
612
> flush(stderr()); flush(stdout())
613
> 
614
> ### Name: dependsOnPkgs
615
> ### Title: Find Reverse Dependencies
616
> ### Aliases: dependsOnPkgs
617
> ### Keywords: utilities
618
> 
619
> ### ** Examples
620
> 
621
> 
622
> cleanEx()
623
> nameEx("encoded")
624
> ### * encoded
625
> 
626
> flush(stderr()); flush(stdout())
627
> 
628
> ### Name: encoded_text_to_latex
629
> ### Title: Translate non-ASCII Text to LaTeX Escapes
630
> ### Aliases: encoded_text_to_latex
631
> ### Keywords: utilities
632
> 
633
> ### ** Examples
634
> 
84678 ripley 635
> x <- "fran\xE7ais"
56186 murdoch 636
> encoded_text_to_latex(x, "latin1")
84678 ripley 637
[1] "fran{\\c c}ais"
56186 murdoch 638
> ## Not run: 
639
> ##D ## create a tex file to show the upper half of 8-bit charsets
61161 ripley 640
> ##D x <- rawToChar(as.raw(160:255), multiple = TRUE)
641
> ##D (x <- matrix(x, ncol = 16, byrow = TRUE))
56186 murdoch 642
> ##D xx <- x
643
> ##D xx[] <- encoded_text_to_latex(x, "latin1") # or latin2 or latin9
61161 ripley 644
> ##D xx <- apply(xx, 1, paste, collapse = "&")
56186 murdoch 645
> ##D con <- file("test-encoding.tex", "w")
646
> ##D header <- c(
647
> ##D "\\documentclass{article}",
648
> ##D "\\usepackage[T1]{fontenc}",
649
> ##D "\\usepackage{Rd}",
650
> ##D "\\begin{document}",
651
> ##D "\\HeaderA{test}{}{test}",
85368 smeyer 652
> ##D "\\begin{Details}\\relax",
56186 murdoch 653
> ##D "\\Tabular{cccccccccccccccc}{")
654
> ##D trailer <- c("}", "\\end{Details}", "\\end{document}")
655
> ##D writeLines(header, con)
85368 smeyer 656
> ##D writeLines(paste0(xx, "\\\\"), con)
56186 murdoch 657
> ##D writeLines(trailer, con)
658
> ##D close(con)
659
> ##D ## and some UTF_8 chars
660
> ##D x <- intToUtf8(as.integer(
661
> ##D     c(160:383,0x0192,0x02C6,0x02C7,0x02CA,0x02D8,
662
> ##D       0x02D9, 0x02DD, 0x200C, 0x2018, 0x2019, 0x201C,
663
> ##D       0x201D, 0x2020, 0x2022, 0x2026, 0x20AC)),
61161 ripley 664
> ##D                multiple = TRUE)
665
> ##D x <- matrix(x, ncol = 16, byrow = TRUE)
56186 murdoch 666
> ##D xx <- x
667
> ##D xx[] <- encoded_text_to_latex(x, "UTF-8")
61161 ripley 668
> ##D xx <- apply(xx, 1, paste, collapse = "&")
56186 murdoch 669
> ##D con <- file("test-utf8.tex", "w")
670
> ##D writeLines(header, con)
85368 smeyer 671
> ##D writeLines(paste(xx, "\\\\", sep = ""), con)
56186 murdoch 672
> ##D writeLines(trailer, con)
673
> ##D close(con)
674
> ## End(Not run)
675
> 
676
> 
677
> cleanEx()
678
> nameEx("fileutils")
679
> ### * fileutils
680
> 
681
> flush(stderr()); flush(stdout())
682
> 
683
> ### Name: fileutils
684
> ### Title: File Utilities
685
> ### Aliases: file_ext file_path_as_absolute file_path_sans_ext
686
> ###   list_files_with_exts list_files_with_type
687
> ### Keywords: file
688
> 
689
> ### ** Examples
690
> 
691
> 
692
> cleanEx()
63623 ripley 693
> nameEx("find_gs_cmd")
694
> ### * find_gs_cmd
695
> 
696
> flush(stderr()); flush(stdout())
697
> 
698
> ### Name: find_gs_cmd
90182 hornik 699
> ### Title: Find a Ghostscript Executable
66799 ripley 700
> ### Aliases: find_gs_cmd R_GSCMD GSC
63623 ripley 701
> 
702
> ### ** Examples
703
> ## Not run: 
90182 hornik 704
> ##D ## Suppose a Solaris system has Ghostscript 9.00 on the path and
63623 ripley 705
> ##D ## 9.07 in /opt/csw/bin.  Then one might set
706
> ##D Sys.setenv(R_GSCMD = "/opt/csw/bin/gs")
707
> ## End(Not run)
708
> 
709
> 
710
> cleanEx()
62998 murdoch 711
> nameEx("getVignetteInfo")
712
> ### * getVignetteInfo
713
> 
714
> flush(stderr()); flush(stdout())
715
> 
716
> ### Name: getVignetteInfo
73574 hornik 717
> ### Title: Get Information on Installed Vignettes
62998 murdoch 718
> ### Aliases: getVignetteInfo
719
> ### Keywords: utilities documentation
720
> 
721
> ### ** Examples
722
> 
723
> 
724
> 
725
> 
726
> cleanEx()
87983 hornik 727
> nameEx("licensetools")
728
> ### * licensetools
729
> 
730
> flush(stderr()); flush(stdout())
731
> 
732
> ### Name: licensetools
733
> ### Title: License Tools
734
> ### Aliases: analyze_license
735
> 
736
> ### ** Examples
737
> 
88908 smeyer 738
> ## Examples from section 'Licensing' of 'Writing R Extensions':
87983 hornik 739
> analyze_license("GPL-2")
740
$is_empty
741
[1] FALSE
742
 
743
$is_canonical
744
[1] TRUE
745
 
746
$bad_components
747
character(0)
748
 
749
$is_standardizable
750
[1] TRUE
751
 
752
$is_verified
753
[1] TRUE
754
 
755
$standardization
756
[1] "GPL-2"
757
 
758
$components
759
[1] "GPL-2"
760
 
761
$expansions
762
$expansions[[1]]
763
[1] "GPL-2"
764
 
765
 
766
$extensions
767
NULL
768
 
769
$pointers
770
NULL
771
 
772
$is_FOSS
773
[1] TRUE
774
 
775
$restricts_use
776
[1] FALSE
777
 
88240 hornik 778
$spdx
779
[1] "GPL-2.0-only"
780
 
87983 hornik 781
> analyze_license("LGPL (>= 2.0, < 3) | Mozilla Public License")
782
$is_empty
783
[1] FALSE
784
 
785
$is_canonical
786
[1] TRUE
787
 
788
$bad_components
789
character(0)
790
 
791
$is_standardizable
792
[1] TRUE
793
 
794
$is_verified
795
[1] TRUE
796
 
797
$standardization
798
[1] "LGPL (>= 2.0, < 3) | Mozilla Public License"
799
 
800
$components
801
[1] "LGPL (>= 2.0, < 3)"     "Mozilla Public License"
802
 
803
$expansions
804
$expansions[[1]]
805
[1] "LGPL-2"   "LGPL-2.1"
806
 
807
$expansions[[2]]
808
[1] "MPL version 1.0" "MPL version 1.1" "MPL version 2.0"
809
 
810
 
811
$extensions
812
NULL
813
 
814
$pointers
815
NULL
816
 
817
$is_FOSS
818
[1] TRUE
819
 
820
$restricts_use
821
[1] FALSE
822
 
88240 hornik 823
$spdx
824
[1] "LGPL-2.0-only OR LGPL-2.1-only OR MPL-1.0 OR MPL-1.1 OR MPL-2.0"
825
 
87983 hornik 826
> analyze_license("GPL-2 | file LICENCE")
827
$is_empty
828
[1] FALSE
829
 
830
$is_canonical
831
[1] TRUE
832
 
833
$bad_components
834
character(0)
835
 
836
$is_standardizable
837
[1] TRUE
838
 
839
$is_verified
840
[1] TRUE
841
 
842
$standardization
843
[1] "GPL-2 | file LICENCE"
844
 
845
$components
846
[1] "GPL-2"        "file LICENCE"
847
 
848
$expansions
849
$expansions[[1]]
850
[1] "GPL-2"
851
 
852
$expansions[[2]]
853
[1] "file LICENCE"
854
 
855
 
856
$extensions
857
NULL
858
 
859
$pointers
860
[1] "LICENCE"
861
 
862
$is_FOSS
863
[1] TRUE
864
 
865
$restricts_use
866
[1] FALSE
867
 
88240 hornik 868
$spdx
869
[1] "GPL-2.0-only"
870
 
87983 hornik 871
> analyze_license("GPL (>= 2) | BSD_3_clause + file LICENSE")
872
$is_empty
873
[1] FALSE
874
 
875
$is_canonical
876
[1] TRUE
877
 
878
$bad_components
879
character(0)
880
 
881
$is_standardizable
882
[1] TRUE
883
 
884
$is_verified
885
[1] TRUE
886
 
887
$standardization
888
[1] "GPL (>= 2) | BSD_3_clause + file LICENSE"
889
 
890
$components
891
[1] "GPL (>= 2)"                  "BSD_3_clause + file LICENSE"
892
 
893
$expansions
894
$expansions[[1]]
895
[1] "GPL-2" "GPL-3"
896
 
897
$expansions[[2]]
898
[1] "BSD_3_clause + file LICENSE"
899
 
900
 
901
$extensions
902
                   components extensible
903
1 BSD_3_clause + file LICENSE       TRUE
904
 
905
$pointers
906
[1] "LICENSE"
907
 
908
$is_FOSS
909
[1] TRUE
910
 
911
$restricts_use
912
[1] FALSE
913
 
88240 hornik 914
$spdx
915
[1] "GPL-2.0-only OR GPL-3.0-only OR BSD-3-Clause"
916
 
87983 hornik 917
> analyze_license("Artistic-2.0 | AGPL-3 + file LICENSE")
918
$is_empty
919
[1] FALSE
920
 
921
$is_canonical
922
[1] TRUE
923
 
924
$bad_components
925
character(0)
926
 
927
$is_standardizable
928
[1] TRUE
929
 
930
$is_verified
931
[1] TRUE
932
 
933
$standardization
934
[1] "Artistic-2.0 | AGPL-3 + file LICENSE"
935
 
936
$components
937
[1] "Artistic-2.0"          "AGPL-3 + file LICENSE"
938
 
939
$expansions
940
$expansions[[1]]
941
[1] "Artistic-2.0"
942
 
943
$expansions[[2]]
944
[1] "AGPL-3 + file LICENSE"
945
 
946
 
947
$extensions
948
             components extensible
949
1 AGPL-3 + file LICENSE       TRUE
950
 
951
$pointers
952
[1] "LICENSE"
953
 
954
$is_FOSS
955
[1] TRUE
956
 
957
$restricts_use
958
[1] FALSE
959
 
88240 hornik 960
$spdx
961
[1] "Artistic-2.0 OR AGPL-3.0-only"
962
 
87983 hornik 963
> 
964
> 
965
> 
966
> cleanEx()
66000 murdoch 967
> nameEx("loadRdMacros")
968
> ### * loadRdMacros
969
> 
970
> flush(stderr()); flush(stdout())
971
> 
972
> ### Name: loadRdMacros
73574 hornik 973
> ### Title: Load User-defined Rd Help System Macros
66000 murdoch 974
> ### Aliases: loadRdMacros loadPkgRdMacros
975
> ### Keywords: utilities documentation
976
> 
977
> ### ** Examples
978
> 
82666 smeyer 979
> f <- tempfile()
82753 smeyer 980
> writeLines(r"(
981
+ \newcommand{\Rlogo}{
982
+   \if{html}{\figure{Rlogo.svg}{options: width=100 alt="R logo"}}
983
+   \if{latex}{\figure{Rlogo.pdf}{options: width=0.5in}}
984
+ }
985
+ )", f)
82666 smeyer 986
> m <- loadRdMacros(f)
987
> ls(m)
988
[1] "\\Rlogo"
989
> ls(parent.env(parent.env(m)))
990
character(0)
82728 smeyer 991
> parse_Rd(textConnection(r"(\Rlogo)"), fragment = TRUE, macros = m)
82753 smeyer 992
 
993
  \if{html}{\figure{Rlogo.svg}{options: width=100 alt="R logo"}}
994
  \if{latex}{\figure{Rlogo.pdf}{options: width=0.5in}}
995
 
66000 murdoch 996
> 
997
> 
998
> 
999
> cleanEx()
70524 ripley 1000
> nameEx("makevars")
1001
> ### * makevars
1002
> 
1003
> flush(stderr()); flush(stdout())
1004
> 
1005
> ### Name: makevars
1006
> ### Title: User and Site Compilation Variables
1007
> ### Aliases: makevars_user makevars_site
1008
> ### Keywords: utilities
1009
> 
1010
> ### ** Examples
70617 maechler 1011
> ## Don't show: 
1012
> checkMV <- function(r)
1013
+   stopifnot(is.character(r),
1014
+             length(r) == 0 || (length(r) == 1 && file.exists(r)))
1015
> checkMV(makevars_user())
1016
> checkMV(makevars_site())
1017
> ## End(Don't show)
70524 ripley 1018
> 
1019
> 
70617 maechler 1020
> 
70524 ripley 1021
> cleanEx()
56186 murdoch 1022
> nameEx("md5sum")
1023
> ### * md5sum
1024
> 
1025
> flush(stderr()); flush(stdout())
1026
> 
1027
> ### Name: md5sum
1028
> ### Title: Compute MD5 Checksums
1029
> ### Aliases: md5sum
1030
> ### Keywords: utilities
1031
> 
1032
> ### ** Examples
1033
> 
61161 ripley 1034
> as.vector(md5sum(dir(R.home(), pattern = "^COPY", full.names = TRUE)))
56186 murdoch 1035
[1] "eb723b61539feef013de476e68b5c50a"
87162 urbaneks 1036
> md5sum(bytes=raw())
1037
[1] "d41d8cd98f00b204e9800998ecf8427e"
1038
> md5sum(bytes=charToRaw("abc"))
1039
[1] "900150983cd24fb0d6963f7d28e17f72"
56186 murdoch 1040
> 
1041
> 
1042
> 
1043
> cleanEx()
58433 ligges 1044
> nameEx("package_dependencies")
1045
> ### * package_dependencies
1046
> 
1047
> flush(stderr()); flush(stdout())
1048
> 
1049
> ### Name: package_dependencies
1050
> ### Title: Computations on the Dependency Hierarchy of Packages
1051
> ### Aliases: package_dependencies
1052
> ### Keywords: utilities
1053
> 
1054
> ### ** Examples
1055
> 
1056
> 
1057
> 
1058
> 
1059
> cleanEx()
72103 ripley 1060
> nameEx("package_native_routine_registration_skeleton")
1061
> ### * package_native_routine_registration_skeleton
1062
> 
1063
> flush(stderr()); flush(stdout())
1064
> 
1065
> ### Name: package_native_routine_registration_skeleton
1066
> ### Title: Write Skeleton for Adding Native Routine Registration to a
1067
> ###   Package
1068
> ### Aliases: package_native_routine_registration_skeleton
1069
> 
1070
> ### ** Examples
1071
> ## Not run: 
1072
> ##D ## with a completed splines/DESCRIPTION file,
72124 ripley 1073
> ##D tools::package_native_routine_registration_skeleton('splines',,,FALSE)
72103 ripley 1074
> ##D ## produces
72124 ripley 1075
> ##D #include <R.h>
72103 ripley 1076
> ##D #include <Rinternals.h>
72124 ripley 1077
> ##D #include <stdlib.h> // for NULL
72103 ripley 1078
> ##D #include <R_ext/Rdynload.h>
1079
> ##D 
1080
> ##D /* FIXME: 
72124 ripley 1081
> ##D    Check these declarations against the C/Fortran source code.
72103 ripley 1082
> ##D */
1083
> ##D 
72124 ripley 1084
> ##D /* .Call calls */
1085
> ##D extern SEXP spline_basis(SEXP, SEXP, SEXP, SEXP);
1086
> ##D extern SEXP spline_value(SEXP, SEXP, SEXP, SEXP, SEXP);
1087
> ##D 
72103 ripley 1088
> ##D static const R_CallMethodDef CallEntries[] = {
1089
> ##D     {"spline_basis", (DL_FUNC) &spline_basis, 4},
1090
> ##D     {"spline_value", (DL_FUNC) &spline_value, 5},
1091
> ##D     {NULL, NULL, 0}
1092
> ##D };
1093
> ##D 
1094
> ##D void R_init_splines(DllInfo *dll)
1095
> ##D {
1096
> ##D     R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
1097
> ##D     R_useDynamicSymbols(dll, FALSE);
1098
> ##D }
1099
> ## End(Not run)
1100
> 
1101
> 
1102
> cleanEx()
56186 murdoch 1103
> nameEx("parseLatex")
1104
> ### * parseLatex
1105
> 
1106
> flush(stderr()); flush(stdout())
1107
> 
1108
> ### Name: parseLatex
73574 hornik 1109
> ### Title: Experimental Functions to Work with LaTeX Code
56186 murdoch 1110
> ### Aliases: parseLatex deparseLatex latexToUtf8
1111
> ### Keywords: utilities documentation
1112
> 
1113
> ### ** Examples
1114
> 
88521 smeyer 1115
> latex <- parseLatex("fran\\c{c}ais", verbose = TRUE)
1116
1:1: TEXT: fran
1117
1:5: MACRO: \c
1118
1:7: '{'
1119
1:8: TEXT: c
1120
1:9: '}'
1121
1:10: TEXT: ais
1122
1:13: END_OF_INPUT
1123
> ## IGNORE_RDIFF_BEGIN
1124
> deparseLatex(latexToUtf8(latex))
1125
[1] "français"
1126
> ## IGNORE_RDIFF_END
56186 murdoch 1127
> 
88559 smeyer 1128
> deparseLatex(parseLatex("$t$"), math = c("\\eqn{", "}"))
1129
[1] "\\eqn{t}"
88521 smeyer 1130
> 
1131
> 
88559 smeyer 1132
> 
56186 murdoch 1133
> cleanEx()
86241 ripley 1134
> nameEx("pkg2HTML")
1135
> ### * pkg2HTML
1136
> 
1137
> flush(stderr()); flush(stdout())
1138
> 
1139
> ### Name: pkg2HTML
1140
> ### Title: Rd Converters
1141
> ### Aliases: pkg2HTML
1142
> ### Keywords: documentation
1143
> 
1144
> ### ** Examples
1145
> 
1146
> 
1147
> 
1148
> 
1149
> cleanEx()
61330 ripley 1150
> nameEx("print.via.format")
1151
> ### * print.via.format
1152
> 
1153
> flush(stderr()); flush(stdout())
1154
> 
1155
> ### Name: .print.via.format
1156
> ### Title: Printing Utilities
1157
> ### Aliases: .print.via.format
1158
> ### Keywords: utilities
1159
> 
1160
> ### ** Examples
1161
> 
1162
> ## The function is simply defined as
1163
>  function (x, ...) {
1164
+     writeLines(format(x, ...))
1165
+     invisible(x)
1166
+  }
1167
function (x, ...) 
1168
{
1169
    writeLines(format(x, ...))
1170
    invisible(x)
1171
}
1172
> 
1173
> ## is used for simple print methods in R, and as prototype for new methods.
1174
> 
1175
> 
1176
> 
1177
> cleanEx()
56634 ripley 1178
> nameEx("pskill")
1179
> ### * pskill
1180
> 
1181
> flush(stderr()); flush(stdout())
1182
> 
1183
> ### Name: pskill
1184
> ### Title: Kill a Process
1185
> ### Aliases: pskill SIGHUP SIGINT SIGQUIT SIGKILL SIGTERM SIGSTOP SIGTSTP
56644 ripley 1186
> ###   SIGCONT SIGCHLD SIGUSR1 SIGUSR2
56634 ripley 1187
> ### Keywords: utilities
1188
> 
1189
> ### ** Examples
1190
> ## Not run: 
1191
> ##D pskill(c(237, 245), SIGKILL)
1192
> ## End(Not run)
1193
> 
1194
> 
1195
> cleanEx()
87179 urbaneks 1196
> nameEx("sha256sum")
1197
> ### * sha256sum
1198
> 
1199
> flush(stderr()); flush(stdout())
1200
> 
1201
> ### Name: sha256sum
87184 maechler 1202
> ### Title: Compute SHA-256 Checksums
87179 urbaneks 1203
> ### Aliases: sha256sum
1204
> ### Keywords: utilities
1205
> 
1206
> ### ** Examples
1207
> 
1208
> as.vector(sha256sum(dir(R.home(), pattern = "^COPY", full.names = TRUE)))
1209
[1] "e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4"
1210
> sha256sum(bytes=raw())
1211
[1] "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
1212
> sha256sum(bytes=charToRaw("abc"))
1213
[1] "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
1214
> 
1215
> 
1216
> 
1217
> cleanEx()
56186 murdoch 1218
> nameEx("showNonASCII")
1219
> ### * showNonASCII
1220
> 
1221
> flush(stderr()); flush(stdout())
1222
> 
1223
> ### Name: showNonASCII
1224
> ### Title: Pick Out Non-ASCII Characters
1225
> ### Aliases: showNonASCII showNonASCIIfile
1226
> ### Keywords: utilities
1227
> 
1228
> ### ** Examples
1229
> 
1230
> out <- c(
84678 ripley 1231
+ "fran\xE7ais: test of showNonASCII():",
56186 murdoch 1232
+ "\\details{",
1233
+ "   This is a good line",
1234
+ "   This has an \xfcmlaut in it.",
1235
+ "   OK again.",
1236
+ "}")
1237
> f <- tempfile()
1238
> cat(out, file = f, sep = "\n")
1239
> 
85238 ripley 1240
> ## IGNORE_RDIFF_BEGIN
56186 murdoch 1241
> showNonASCIIfile(f)
85329 maechler 1242
1: fran<e7>ais: test of showNonASCII():
1243
4:    This has an <fc>mlaut in it.
85238 ripley 1244
> ## IGNORE_RDIFF_END
56186 murdoch 1245
> unlink(f)
1246
> 
1247
> 
1248
> 
1249
> cleanEx()
85329 maechler 1250
> nameEx("testInstalledPackage")
1251
> ### * testInstalledPackage
1252
> 
1253
> flush(stderr()); flush(stdout())
1254
> 
1255
> ### Name: testInstalledPackage
1256
> ### Title: Test Installed Packages
1257
> ### Aliases: testInstalledPackage testInstalledPackages testInstalledBasic
1258
> ###   TEST_MC_CORES standard_package_names
1259
> ### Keywords: utilities
1260
> 
1261
> ### ** Examples
1262
> 
1263
> str(stPkgs <- standard_package_names())
1264
List of 2
1265
 $ base       : chr [1:14] "base" "tools" "utils" "grDevices" ...
1266
 $ recommended: chr [1:15] "MASS" "lattice" "Matrix" "nlme" ...
1267
> 
1268
> 
1269
> 
1270
> cleanEx()
56186 murdoch 1271
> nameEx("toHTML")
1272
> ### * toHTML
1273
> 
1274
> flush(stderr()); flush(stdout())
1275
> 
1276
> ### Name: toHTML
73574 hornik 1277
> ### Title: Display an Object in HTML
56186 murdoch 1278
> ### Aliases: toHTML toHTML.packageIQR toHTML.news_db
1279
> ### Keywords: utilities documentation
1280
> 
1281
> ### ** Examples
1282
> 
61161 ripley 1283
> cat(toHTML(demo(package = "base")), sep = "\n")
81689 hornik 1284
<!DOCTYPE html>
1285
<html>
66083 ripley 1286
<head><title>R: R</title>
88673 hornik 1287
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
1288
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
1289
<link rel="stylesheet" type="text/css" href="/doc/html/R.css">
80268 deepayan 1290
</head><body><div class="container">
56186 murdoch 1291
<h1> R
88673 hornik 1292
<img class="toplogo" src="/doc/html/Rlogo.svg" alt="[R logo]">
56186 murdoch 1293
</h1>
88673 hornik 1294
<hr>
66083 ripley 1295
<div style="text-align: center;">
88673 hornik 1296
<a href="/doc/html/index.html"><img class="arrow" src="/doc/html/up.jpg" alt="[Top]"></a>
56186 murdoch 1297
</div>
1298
<h2>Demos in package &lsquo;base&rsquo;</h2>
82302 hornik 1299
<table cols="2" style="width: 100%;">
56186 murdoch 1300
<tr>
66083 ripley 1301
 <td style="text-align: left; vertical-align: top; width: 10%;">
56186 murdoch 1302
error.catching
1303
 </td>
69793 ripley 1304
 <td style="text-align: left; vertical-align: top; width: 90%;">
56186 murdoch 1305
More examples on catching and handling errors
1306
 </td>
1307
</tr>
1308
 
1309
<tr>
66083 ripley 1310
 <td style="text-align: left; vertical-align: top; width: 10%;">
56186 murdoch 1311
is.things
1312
 </td>
69793 ripley 1313
 <td style="text-align: left; vertical-align: top; width: 90%;">
56186 murdoch 1314
Explore some properties of R objects and is.FOO() functions. Not for newbies!
1315
 </td>
1316
</tr>
1317
 
1318
<tr>
66083 ripley 1319
 <td style="text-align: left; vertical-align: top; width: 10%;">
56186 murdoch 1320
recursion
1321
 </td>
69793 ripley 1322
 <td style="text-align: left; vertical-align: top; width: 90%;">
56186 murdoch 1323
Using recursion for adaptive integration
1324
 </td>
1325
</tr>
1326
 
1327
<tr>
66083 ripley 1328
 <td style="text-align: left; vertical-align: top; width: 10%;">
56186 murdoch 1329
scoping
1330
 </td>
69793 ripley 1331
 <td style="text-align: left; vertical-align: top; width: 90%;">
56186 murdoch 1332
An illustration of lexical scoping.
1333
 </td>
1334
</tr>
1335
 
1336
</table>
1337
<p>
1338
</p>
80268 deepayan 1339
</div></body></html>
56186 murdoch 1340
> 
1341
> 
1342
> 
1343
> cleanEx()
86901 maechler 1344
> nameEx("toTitleCase")
1345
> ### * toTitleCase
1346
> 
1347
> flush(stderr()); flush(stdout())
1348
> 
1349
> ### Name: toTitleCase
1350
> ### Title: Convert Titles to Title Case
1351
> ### Aliases: toTitleCase
1352
> 
1353
> ### ** Examples
1354
> 
1355
> toTitleCase("bayesian network modeling and analysis")
1356
[1] "Bayesian Network Modeling and Analysis"
1357
> toTitleCase("ensemble tool for predictions from species distribution models")
1358
[1] "Ensemble Tool for Predictions from Species Distribution Models"
1359
> ## Treatment after "-":
1360
> toTitleCase("small- and large-scale analysis") # lowercase "and"
1361
[1] "Small- and Large-Scale Analysis"
1362
> 
1363
> toTitleCase("a small fox is jumping")    # "a Small Fox is .."     (the 'a' may change)% i.e. BUG
1364
[1] "a Small Fox is Jumping"
1365
> toTitleCase("is a small fox jumping?")   # "Is a Small Fox .."     (fine)
1366
[1] "Is a Small Fox Jumping?"
1367
> ## After ":", start a new sentence
1368
> toTitleCase("a pangram: the quick brown fox jumps over the lazy dog")
1369
[1] "a Pangram: The Quick Brown Fox Jumps over the Lazy Dog"
1370
> toTitleCase("asking -- 'is a small fox jumping?'") # ".. -- Is a Small ..."     (fine)
1371
[1] "Asking -- 'Is a Small Fox Jumping?'"
1372
> 
1373
> 
1374
> 
1375
> cleanEx()
56186 murdoch 1376
> nameEx("undoc")
1377
> ### * undoc
1378
> 
1379
> flush(stderr()); flush(stdout())
1380
> 
1381
> ### Name: undoc
1382
> ### Title: Find Undocumented Objects
1383
> ### Aliases: undoc print.undoc
1384
> ### Keywords: documentation
1385
> 
1386
> ### ** Examples
1387
> 
1388
> undoc("tools")                  # Undocumented objects in 'tools'
1389
> 
1390
> 
1391
> 
1392
> cleanEx()
76358 lawrence 1393
> nameEx("updatePACKAGES")
1394
> ### * updatePACKAGES
1395
> 
1396
> flush(stderr()); flush(stdout())
1397
> 
1398
> ### Name: update_PACKAGES
1399
> ### Title: Update Existing PACKAGES Files
1400
> ### Aliases: update_PACKAGES
1401
> ### Keywords: file utilities
1402
> 
1403
> ### ** Examples
1404
> 
1405
> ## Not run: 
76420 ripley 1406
> ##D write_PACKAGES("c:/myFolder/myRepository") # on Windows
76358 lawrence 1407
> ##D update_PACKAGES("c:/myFolder/myRepository") # on Windows
1408
> ##D write_PACKAGES("/pub/RWin/bin/windows/contrib/2.9",
76420 ripley 1409
> ##D type = "win.binary") # on Linux
76358 lawrence 1410
> ##D update_PACKAGES("/pub/RWin/bin/windows/contrib/2.9",
76420 ripley 1411
> ##D type = "win.binary") # on Linux
76358 lawrence 1412
> ## End(Not run)
1413
> 
1414
> 
1415
> cleanEx()
86951 hornik 1416
> nameEx("urltools")
1417
> ### * urltools
1418
> 
1419
> flush(stderr()); flush(stdout())
1420
> 
1421
> ### Name: urltools
1422
> ### Title: Check Package URLs
1423
> ### Aliases: check_package_urls parse_URI_reference
1424
> ### Keywords: utilities
1425
> 
1426
> ### ** Examples
1427
> 
1428
> ## Examples from RFC 3986.
1429
> parse_URI_reference(c("foo://example.com:8042/over/there?name=ferret#nose",
1430
+                       "urn:example:animal:ferret:nose",
1431
+                       "mailto:John.Doe@example.com",
1432
+                       "tel:+1-816-555-1212"))
1433
  scheme        authority                       path       query fragment
1434
1    foo example.com:8042                /over/there name=ferret     nose
1435
2    urn                  example:animal:ferret:nose                     
1436
3 mailto                        John.Doe@example.com                     
1437
4    tel                             +1-816-555-1212                     
1438
> 
1439
> 
1440
> 
1441
> cleanEx()
77872 hornik 1442
> nameEx("userdir")
1443
> ### * userdir
1444
> 
1445
> flush(stderr()); flush(stdout())
1446
> 
1447
> ### Name: userdir
1448
> ### Title: R User Directories
1449
> ### Aliases: R_user_dir
1450
> 
1451
> ### ** Examples
1452
> ## IGNORE_RDIFF_BEGIN
1453
> R_user_dir("FOO", "cache")
88727 hornik 1454
[1] "/home/hornik/.cache/R/FOO"
85990 smeyer 1455
> 
84678 ripley 1456
> ## Create one, platform agnostically, must work if <normal> :
1457
> (Rdb <- R_user_dir("base"))
88727 hornik 1458
[1] "/home/hornik/.local/share/R/base"
86009 smeyer 1459
> if(newD <- !dir.exists(Rdb)) # should work user specifically:
1460
+     newD <- dir.create(Rdb, recursive=TRUE)
84678 ripley 1461
> dir(Rdb) # typically empty
1462
character(0)
86009 smeyer 1463
> if(newD) unlink(Rdb) # cleaning up
85990 smeyer 1464
> 
84678 ripley 1465
> list.files(R_user_dir("grid"), full.names = TRUE)
1466
character(0)
77872 hornik 1467
> ## IGNORE_RDIFF_END
1468
> 
1469
> 
1470
> cleanEx()
61822 murdoch 1471
> nameEx("vignetteEngine")
1472
> ### * vignetteEngine
1473
> 
1474
> flush(stderr()); flush(stdout())
1475
> 
1476
> ### Name: vignetteEngine
62277 ripley 1477
> ### Title: Set or Get a Vignette Processing Engine
61822 murdoch 1478
> ### Aliases: vignetteEngine
1479
> ### Keywords: utilities documentation
1480
> 
1481
> ### ** Examples
1482
> 
1483
> str(vignetteEngine("Sweave"))
63202 ripley 1484
List of 6
62138 ripley 1485
 $ name   : chr "Sweave"
1486
 $ package: chr "utils"
1487
 $ pattern: chr "[.][rRsS](nw|tex)$"
1488
 $ weave  :function (...)  
1489
 $ tangle :function (...)  
63202 ripley 1490
 $ aspell :List of 2
1491
  ..$ filter : chr "Sweave"
1492
  ..$ control: chr "-t"
61822 murdoch 1493
> 
1494
> 
1495
> 
1496
> cleanEx()
75291 ripley 1497
> nameEx("vignetteInfo")
1498
> ### * vignetteInfo
1499
> 
1500
> flush(stderr()); flush(stdout())
1501
> 
1502
> ### Name: vignetteInfo
1503
> ### Title: Basic Information about a Vignette
1504
> ### Aliases: vignetteInfo
1505
> ### Keywords: utilities
1506
> 
1507
> ### ** Examples
1508
> 
80307 ripley 1509
>   gridEx <- system.file("doc", "grid.Rnw", package = "grid")
1510
>   vi <- vignetteInfo(gridEx)
1511
>   str(vi)
1512
List of 5
1513
 $ file    : chr "grid.Rnw"
1514
 $ title   : chr "Introduction to grid"
1515
 $ depends : chr(0) 
1516
 $ keywords: chr(0) 
1517
 $ engine  : chr "utils::Sweave"
75291 ripley 1518
> 
80307 ripley 1519
> 
1520
> 
75291 ripley 1521
> cleanEx()
56186 murdoch 1522
> nameEx("writePACKAGES")
1523
> ### * writePACKAGES
1524
> 
1525
> flush(stderr()); flush(stdout())
1526
> 
1527
> ### Name: write_PACKAGES
73574 hornik 1528
> ### Title: Generate PACKAGES Files
56186 murdoch 1529
> ### Aliases: write_PACKAGES
1530
> ### Keywords: file utilities
1531
> 
1532
> ### ** Examples
1533
> 
1534
> ## Not run: 
1535
> ##D write_PACKAGES("c:/myFolder/myRepository")  # on Windows
1536
> ##D write_PACKAGES("/pub/RWin/bin/windows/contrib/2.9",
61161 ripley 1537
> ##D                type = "win.binary")  # on Linux
56186 murdoch 1538
> ## End(Not run)
1539
> 
1540
> 
1541
> cleanEx()
1542
> nameEx("xgettext")
1543
> ### * xgettext
1544
> 
1545
> flush(stderr()); flush(stdout())
1546
> 
1547
> ### Name: xgettext
1548
> ### Title: Extract Translatable Messages from R Files in a Package
1549
> ### Aliases: xgettext xngettext xgettext2pot
1550
> ### Keywords: utilities
1551
> 
1552
> ### ** Examples
1553
> ## Not run: 
81047 ripley 1554
> ##D ## in a source-directory build (not typical!) of R;
1555
> ##D ## otherwise, download and unpack the R sources, and replace
1556
> ##D ## R.home()  by  "<my_path_to_source_R>" :
56186 murdoch 1557
> ##D xgettext(file.path(R.home(), "src", "library", "splines"))
1558
> ## End(Not run)
1559
> 
81108 maechler 1560
> ## Create source package-like  <tmp>/R/foo.R  and get text from it:
1561
> tmpPkg <- tempdir()
1562
> tmpRDir <- file.path(tmpPkg, "R")
1563
> dir.create(tmpRDir, showWarnings = FALSE)
1564
> fnChar <- paste(sep = "\n",
1565
+   "foo <- function(x) {",
1566
+   "  if (x < -1)  stop('too small')",
1567
+   "  # messages unduplicated (not so for ngettext)",
1568
+   "  if (x < -.5) stop('too small')",
1569
+   "  if (x < 0) {",
1570
+   "    warning(",
1571
+   "      'sqrt(x) is', sqrt(as.complex(x)),",
1572
+   "      ', which may be too small'",
1573
+   "    )",
1574
+   "  }",
1575
+   "  # calls with domain=NA are skipped",
1576
+   "  if (x == 0) cat(gettext('x is 0!\n', domain=NA))",
1577
+   "  # gettext strings may be ignored due to 'outer' domain=NA",
84437 smeyer 1578
+   "  if (x > 10) warning('x is ', gettextf('%.2f', x), domain=NA)",
1579
+   "  # using a custom condition class",
84438 smeyer 1580
+   "  if (x == 42)",
1581
+   "    stop(errorCondition(gettext('needs Deep Thought'), class='myError'))",
81108 maechler 1582
+   "  x",
1583
+   "}")
56186 murdoch 1584
> 
81108 maechler 1585
> writeLines(fnChar, con = file.path(tmpRDir, "foo.R"))
1586
> 
81130 maechler 1587
> ## [[1]] : suppressing (tmpfile) name to make example Rdiff-able
84437 smeyer 1588
> xgettext(tmpPkg, asCall=TRUE )[[1]] # default; shows calls
81108 maechler 1589
too small
1590
sqrt(x) is
1591
sqrt(as.complex(x))
1592
, which may be too small
84438 smeyer 1593
errorCondition(gettext("needs Deep Thought"), class = "myError")
81130 maechler 1594
> xgettext(tmpPkg, asCall=FALSE)[[1]] # doesn't ; but then ' %.2f '
81108 maechler 1595
too small
1596
sqrt(x) is
1597
, which may be too small
1598
%.2f
84437 smeyer 1599
needs Deep Thought
81108 maechler 1600
> 
1601
> unlink(tmpRDir, recursive=TRUE)
1602
> 
1603
> 
1604
> 
56186 murdoch 1605
> ### * <FOOTER>
1606
> ###
73819 hornik 1607
> cleanEx()
62439 ripley 1608
> options(digits = 7L)
61787 ripley 1609
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
88727 hornik 1610
Time elapsed:  0.338 0.018 0.748 0.284 0.109 
56186 murdoch 1611
> grDevices::dev.off()
1612
null device 
1613
          1 
1614
> ###
1615
> ### Local variables: ***
1616
> ### mode: outline-minor ***
1617
> ### outline-regexp: "\\(> \\)?### [*]+" ***
1618
> ### End: ***
1619
> quit('no')