/
index.html
236 lines (208 loc) · 15.1 KB
/
index.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Easily Apply Formats to Data • fmtr</title>
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="apple-touch-icon.png">
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="apple-touch-icon-60x60.png">
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="bootstrap-toc.css">
<script src="bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="pkgdown.css" rel="stylesheet">
<script src="pkgdown.js"></script><script src="extra.js"></script><meta property="og:title" content="Easily Apply Formats to Data ">
<meta property="og:description" content="Contains a set of functions that can be used to apply
formats to data frames or vectors. The package aims to provide
functionality similar to that of SAS® formats. Formats are assigned to
the format attribute on data frame columns. Then when the fdata()
function is called, a new data frame is created with the column data
formatted as specified. The package also contains a value() function
to create a user-defined format, similar to a SAS® user-defined format.">
<meta property="og:image" content="https://fmtr.r-sassy.org/logo.png">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body data-spy="scroll" data-target="#toc">
<div class="container template-home">
<header><div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">fmtr</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.2</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"></ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="articles/fmtr.html">Get started</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="articles/fmtr-fdata.html">Format Data Function</a>
</li>
<li>
<a href="articles/fmtr-fapply.html">Format Apply Function</a>
</li>
<li>
<a href="articles/fmtr-fcat.html">Format Catalogs</a>
</li>
<li>
<a href="articles/fmtr-convenience.html">Convenience Functions</a>
</li>
<li>
<a href="articles/fmtr-helpers.html">Helper Functions</a>
</li>
<li>
<a href="articles/fmtr-example1.html">Complete Example</a>
</li>
<li>
<a href="articles/fmtr-faq.html">Frequently Asked Questions</a>
</li>
</ul>
</li>
<li>
<a href="reference/index.html">Reference</a>
</li>
<li>
<a href="./articles/fmtr-faq.html">FAQ</a>
</li>
<li>
<a href="news/index.html">Changelog</a>
</li>
<li>
<a href="https://github.com/dbosak01/fmtr/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
<!--/.container -->
</div>
<!--/.navbar -->
</header><div class="row">
<div class="contents col-md-9">
<!-- badges: end -->
<div class="section level1">
<div class="page-header"><h1 id="introduction-to-fmtr">Introduction to <strong>fmtr</strong>
<a class="anchor" aria-label="anchor" href="#introduction-to-fmtr"></a>
</h1></div>
<p><img src="man/images/fmtr_new.png" align="left" height="138px" style="height:138px;margin-right:10px"></p>
<p>R has a variety of ways to format data. There are functions for formatting dates, several functions to format numbers, plus you can always do a lookup with a named vector, or write your own vectorized function. Yet there are several problems with the way R handles formatting.</p>
<p>One problem is that there are <em>too many</em> formatting functions. It is not easy to remember which functions do what, and the differences between them. One goal of the <strong>fmtr</strong> package is to consolidate R’s formatting capabilities into a smaller number of functions.</p>
<p>Another problem is when you want to <em>reuse</em> a format. While there are many ways to format data, there is no mechanism to save a format and reuse it later. Therefore, another goal of the <strong>fmtr</strong> package is to promote format reuse.</p>
<p>A third problem is when you have a complex format that can only be accomplished with multiple formatting functions. It would be nice to have a way to keep these multiple formats together, and assign them all at once.</p>
<p>Finally, there are some formatting activities that are so common, it seems like there should be a function for it. The <strong>fmtr</strong> package also contains several functions that fall into this category.</p>
<div class="section level3">
<h3 id="solution">Solution<a class="anchor" aria-label="anchor" href="#solution"></a>
</h3>
<p>The <strong>fmtr</strong> package was developed to address the above problems. The package addresses those problems in the following ways:</p>
<ol style="list-style-type: decimal">
<li><p><strong>Two formatting functions</strong>: With <strong>fmtr</strong>, all formatting has been consolidated into two formatting functions: <code><a href="reference/fapply.html">fapply()</a></code> and <code><a href="reference/fdata.html">fdata()</a></code>. <code><a href="reference/fapply.html">fapply()</a></code> applies a format to a vector. <code><a href="reference/fdata.html">fdata()</a></code> applies formats to a data frame or tibble. The implementation of the <code><a href="reference/fapply.html">fapply()</a></code> function is reminiscent of a SAS® <code>put</code> function.</p></li>
<li><p><strong>The format catalog</strong>: The <strong>fmtr</strong> package also introduces the concept of a <em>format catalog</em> to R. A format catalog is a collection of formats that can be saved as a file, shared, and reused. This concept was taken directly from SAS® software.</p></li>
<li><p><strong>User-defined format</strong>: The <strong>fmtr</strong> package also improves on the native R formatting capabilities by introducing the concept of a <em>user-defined format</em>. A user-defined format is an expression-driven lookup. You can define a set of logical expressions that, when true, will return a corresponding lookup value. The implementation of the user-defined format is similar to a SAS® user-defined format.</p></li>
<li><p><strong>The formatting list</strong>: For complicated formats that require more than one function, the <strong>fmtr</strong> package also introduces the concept of a <em>formatting list</em>. A formatting list can perform operations that are difficult to accomplish otherwise.</p></li>
<li><p><strong>Helper and Convenience functions</strong>: Finally, the <strong>fmtr</strong> package contains a set of functions to help you with common formatting tasks. For instance, it has functions to assist in assigning formatting attributes to an entire data frame. It also has some ready-made functions to perform very common types of statistical formatting.</p></li>
</ol>
<p>All together, the above capabilities make formatting with the <strong>fmtr</strong> package both simpler and more powerful. The reuse features also make R more suitable to team programming.</p>
<p>For additional reading, examples, and a complete function reference, refer to the <strong>fmtr</strong> documentation site <a href="https://fmtr.r-sassy.org/articles/fmtr.html">here</a>.</p>
</div>
<div class="section level3">
<h3 id="installation">Installation<a class="anchor" aria-label="anchor" href="#installation"></a>
</h3>
<p>To install the <strong>fmtr</strong> package, you may do so by running the following command from your R console:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode R"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="fu">install.packages</span>(<span class="st">"fmtr"</span>)</span></code></pre></div>
<p>Then put the following line at the top of your script:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode R"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a><span class="fu">library</span>(fmtr)</span></code></pre></div>
<p>The <strong>fmtr</strong> package will then be loaded, and available for use in your project.</p>
<p>For examples and usage information, please visit the <strong>fmtr</strong> documentation site <a href="https://fmtr.r-sassy.org/articles/fmtr.html">here</a>. These examples will demonstrate the extraordinary usefulness of the formatting functions, and give you many ideas on how and where to use the <strong>fmtr</strong> package.</p>
</div>
<div class="section level3">
<h3 id="getting-help">Getting Help<a class="anchor" aria-label="anchor" href="#getting-help"></a>
</h3>
<p>If you need help with the <strong>fmtr</strong> package, the best place to turn to is the <a href="https://fmtr.r-sassy.org">fmtr</a> web site. This web site offers many examples, and full documentation on every function.</p>
<p>If you want to look at the code for the <strong>fmtr</strong> package, visit the github page <a href="https://github.com/dbosak01/fmtr" class="external-link">here</a>.</p>
<p>If you encounter a bug or have a feature request, please submit your issue <a href="https://github.com/dbosak01/fmtr/issues" class="external-link">here</a></p>
</div>
<div class="section level3">
<h3 id="see-also">See Also<a class="anchor" aria-label="anchor" href="#see-also"></a>
</h3>
<p>The <strong>fmtr</strong> package is part of the <strong>sassy</strong> meta-package. The <strong>sassy</strong> meta-package includes several packages that help make R easier for SAS® programmers. You can read more about the <strong>sassy</strong> package <a href="https://sassy.r-sassy.org" class="external-link">here</a>.</p>
</div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<div class="links">
<h2 data-toc-skip>Links</h2>
<ul class="list-unstyled">
<li><a href="https://cloud.r-project.org/package=fmtr" class="external-link">View on CRAN</a></li>
<li><a href="https://github.com/dbosak01/fmtr/" class="external-link">Browse source code</a></li>
<li><a href="https://github.com/dbosak01/fmtr/issues" class="external-link">Report a bug</a></li>
</ul>
</div>
<div class="license">
<h2 data-toc-skip>License</h2>
<ul class="list-unstyled">
<li>CC0</li>
</ul>
</div>
<div class="citation">
<h2 data-toc-skip>Citation</h2>
<ul class="list-unstyled">
<li><a href="authors.html#citation">Citing fmtr</a></li>
</ul>
</div>
<div class="developers">
<h2 data-toc-skip>Developers</h2>
<ul class="list-unstyled">
<li>David Bosak <br><small class="roles"> Maintainer </small> </li>
</ul>
</div>
<div class="dev-status">
<h2 data-toc-skip>Dev status</h2>
<ul class="list-unstyled">
<li><a href="https://cran.r-project.org/package=fmtr" class="external-link"><img src="https://www.r-pkg.org/badges/version/fmtr" alt="fmtr version"></a></li>
<li><a href="https://cran.r-project.org/package=fmtr" class="external-link"><img src="https://img.shields.io/badge/lifecycle-stable-blue.svg" alt="fmtr lifecycle"></a></li>
<li><a href="https://cran.r-project.org/package=fmtr" class="external-link"><img src="https://cranlogs.r-pkg.org/badges/fmtr" alt="fmtr downloads"></a></li>
<li><a href="https://cran.r-project.org/package=fmtr" class="external-link"><img src="https://cranlogs.r-pkg.org/badges/grand-total/fmtr" alt="fmtr total downloads"></a></li>
<li><a href="https://github.com/dbosak01/fmtr/actions/workflows/R-CMD-check.yaml" class="external-link"><img src="https://github.com/dbosak01/fmtr/actions/workflows/R-CMD-check.yaml/badge.svg" alt="R-CMD-check"></a></li>
<li><a href="https://app.codecov.io/gh/dbosak01/fmtr?branch=master" class="external-link"><img src="https://codecov.io/gh/dbosak01/fmtr/branch/master/graph/badge.svg" alt="Codecov test coverage"></a></li>
</ul>
</div>
</div>
</div>
<footer><div class="copyright">
<p></p>
<p>Developed by David Bosak.</p>
</div>
<div class="pkgdown">
<p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer>
</div>
</body>
</html>