Skip to content

Commit

Permalink
Final commit for version 0.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
cjendres1 committed Jul 17, 2023
1 parent 54cdbf3 commit 79af9d7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: nhanesA
Version: 0.7.4
Date: 2023-06-29
Date: 2023-07-16
Title: NHANES Data Retrieval
Authors@R:
person(given = "Christopher",
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version 0.7.4
================================================================================

- Add option includelabels to nhanes, which keeps the SAS label attribute (thanks @bashiruda https://github.com/cjendres1/nhanes/issues/17).

Version 0.7.3
================================================================================

Expand Down
2 changes: 1 addition & 1 deletion R/nhanes_translate.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ nhanesTranslate <- function(nh_table, colnames=NULL, data = NULL, nchar = 32,
if(length(idx)>0) { ## The column is present. Next we need to decide if it should be translated.
if(length(levels(as.factor(data[[idx]]))) >= mincategories) {
# If we reached this point then yes we are translating
# Check for label attribute
# Check for SAS label attribute
idx_label <- attr(data[[idx]],"label")
data[[idx]] <- as.factor(data[[idx]])
data[[idx]] <- suppressMessages(plyr::mapvalues(data[[idx]], from = translations[[cname]][['Code.or.Value']],
Expand Down
2 changes: 1 addition & 1 deletion vignettes/Introducing_nhanesA.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ df
## ----nhanestranslate2, eval=FALSE---------------------------------------------
# bpx_d_vars <- nhanesTableVars('EXAM', 'BPX_D', namesonly=TRUE)
# #Alternatively may use bpx_d_vars = names(bpx_d)
# bpx_d <- suppressMessages(nhanesTranslate('BPX_D', bpx_d_vars, data=bpx_d))
# bpx_d <- nhanesTranslate('BPX_D', bpx_d_vars, data=bpx_d)

## ----simpletranslate2, echo=FALSE---------------------------------------------
translated <- c('BPAARM', 'BPACSZ', 'BPAEN2', 'BPAEN3', 'BPAEN4', 'BPQ150A', 'BPQ150B', 'BPQ150C', 'BPQ150D', 'BPXPTY', 'BPXPULS', 'PEASCCT1', 'PEASCST1')
Expand Down
6 changes: 3 additions & 3 deletions vignettes/Introducing_nhanesA.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<meta name="author" content="Christopher J. Endres" />

<meta name="date" content="2023-05-21" />
<meta name="date" content="2023-07-16" />

<title>Introducing nhanesA</title>

Expand Down Expand Up @@ -340,7 +340,7 @@

<h1 class="title toc-ignore">Introducing nhanesA</h1>
<h4 class="author">Christopher J. Endres</h4>
<h4 class="date">2023-05-21</h4>
<h4 class="date">2023-07-16</h4>



Expand Down Expand Up @@ -514,7 +514,7 @@ <h3>Apply All Possible Code Translations to a Table</h3>
## 6 2 2 2 2 1 4</code></pre>
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a>bpx_d_vars <span class="ot">&lt;-</span> <span class="fu">nhanesTableVars</span>(<span class="st">&#39;EXAM&#39;</span>, <span class="st">&#39;BPX_D&#39;</span>, <span class="at">namesonly=</span><span class="cn">TRUE</span>)</span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a><span class="co">#Alternatively may use bpx_d_vars = names(bpx_d)</span></span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a>bpx_d <span class="ot">&lt;-</span> <span class="fu">suppressMessages</span>(<span class="fu">nhanesTranslate</span>(<span class="st">&#39;BPX_D&#39;</span>, bpx_d_vars, <span class="at">data=</span>bpx_d))</span></code></pre></div>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a>bpx_d <span class="ot">&lt;-</span> <span class="fu">nhanesTranslate</span>(<span class="st">&#39;BPX_D&#39;</span>, bpx_d_vars, <span class="at">data=</span>bpx_d)</span></code></pre></div>
<pre><code>## Translated columns: BPAARM BPACSZ BPAEN2 BPAEN3 BPAEN4 BPQ150A BPQ150B BPQ150C BPQ150D BPXPTY BPXPULS PEASCCT1 PEASCST1</code></pre>
<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="fu">head</span>(bpx_d[,<span class="dv">6</span><span class="sc">:</span><span class="dv">11</span>])</span></code></pre></div>
<pre><code>## BPQ150A BPQ150B BPQ150C BPQ150D BPAARM BPACSZ
Expand Down

0 comments on commit 79af9d7

Please sign in to comment.