/
checkRdaFiles.html
108 lines (82 loc) · 3.51 KB
/
checkRdaFiles.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Report on Details of Saved Images or Re-saves them</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="R.css">
</head><body>
<table width="100%" summary="page for checkRdaFiles"><tr><td>checkRdaFiles</td><td align="right">R Documentation</td></tr></table>
<h2>
Report on Details of Saved Images or Re-saves them
</h2>
<h3>Description</h3>
<p>This reports for each of the files produced by <code>save</code> the size,
if it was saved in ASCII or XDR binary format, and if it was
compressed (and if so in what format).
</p>
<p>Usually such files have extension ‘<span class="file">.rda</span>’ or ‘<span class="file">.RData</span>’, hence
the name of the function.
</p>
<h3>Usage</h3>
<pre>
checkRdaFiles(paths)
resaveRdaFiles(paths, compress = c("auto", "gzip", "bzip2", "xz"),
compression_level)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>paths</code></td>
<td>
<p>A character vector of paths to <code>save</code> files. If
this specifies a single directory, it is taken to refer to all
‘<span class="file">.rda</span>’ and ‘<span class="file">.RData</span>’ files in that directory.</p>
</td></tr>
<tr valign="top"><td><code>compress, compression_level</code></td>
<td>
<p>type and level of compression: see
<code>save</code>.</p>
</td></tr>
</table>
<h3>Details</h3>
<p><code>compress = "auto"</code> asks <font face="Courier New,Courier" color="#666666"><b>R</b></font> to choose the compression and ignores
<code>compression_level</code>. It will try <code>"gzip"</code>, <code>"bzip2"</code>
and if the <code>"gzip"</code> compressed size is over 10Kb, <code>"xz"</code> and
choose the smallest compressed file (but with a 10% bias towards
<code>"gzip"</code>). This can be slow.
</p>
<h3>Value</h3>
<p>For <code>checkRdaFiles</code>, a data frame with rows names <code>paths</code>
and columns
</p>
<table summary="R valueblock">
<tr valign="top"><td><code>size</code></td>
<td>
<p>numeric: file size in bytes, <code>NA</code> if the file does
not exist.</p>
</td></tr>
<tr valign="top"><td><code>ASCII</code></td>
<td>
<p>logical: true for save(ASCII = TRUE), <code>NA</code> if the
format is not that of an <font face="Courier New,Courier" color="#666666"><b>R</b></font> save file.</p>
</td></tr>
<tr valign="top"><td><code>compress</code></td>
<td>
<p>character: type of compression. One of <code>"gzip"</code>,
<code>"bzip2"</code>, <code>"xz"</code>, <code>"none"</code> or <code>"unknown"</code> (which
means that if this is an <font face="Courier New,Courier" color="#666666"><b>R</b></font> save file it is from a later version of
<font face="Courier New,Courier" color="#666666"><b>R</b></font>).</p>
</td></tr>
<tr valign="top"><td><code>version</code></td>
<td>
<p>integer: the version of the save – usually <code>2</code>
but <code>1</code> for very old files, and <code>NA</code> for other files.</p>
</td></tr>
</table>
<h3>Examples</h3>
<pre>## Not run:
## from a package top-level source directory
paths <- sort(Sys.glob(c("data/*.rda", "data/*.RData")))
(res <- checkRdaFiles(paths))
## pick out some that may need attention
bad <- is.na(res$ASCII) | res$ASCII | (res$size > 1e4 & res$compress == "none")
res[bad, ]
## End(Not run)</pre>
</body></html>