includes cprs data set

This commit is contained in:
AG Damsbo 2022-09-26 13:59:05 +02:00
parent 30b9265b4a
commit c4e7bd4d50
30 changed files with 223 additions and 258 deletions

View File

@ -10,3 +10,5 @@
^logo\.R$
^ver_upd\.R$
^data/cprs\.R$
^data/cprs\.csv$
^data-raw$

View File

@ -11,6 +11,7 @@ License: GPL-3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
LazyData: true
Suggests:
spelling,
testthat (>= 3.0.0)

View File

@ -8,7 +8,8 @@
#' @export
#'
#' @examples
#' fsd<-c("2310450637", "010115-4000", "0101896000","010189-3000","300450-1030","010150-4021")
#' fsd<-c("2310450637", "010190-2000", "010115-4000","300450-1030","010150-4021")
#' cpr_check("2310450637")
#' cpr_check(fsd)
#' all(cpr_check(fsd))
cpr_check<-function(cpr){
@ -37,7 +38,7 @@ cpr_check<-function(cpr){
#' Extracting date of birth from CPR
#'
#' For easy calculation.
#' For easy calculation. Does not handle cprs with letters (interim cpr)
#' @param cpr cpr-numbers as ddmmyy"-."xxxx or ddmmyyxxxx. Also mixed formatting. Vector or data frame column.
#' @keywords cpr
#'
@ -46,7 +47,7 @@ cpr_check<-function(cpr){
#'
#' @examples
#' cpr_dob("231045-0637")
#' fsd<-c("010190-2000", "010115-4000", "0101896000","010189-3000","300450-1030","010150-4021")
#' fsd<-c("2310450637", "010190-2000", "010115-4000","300450-1030","010150-4021")
#' cpr_dob(fsd)
cpr_dob<-function(cpr){
## Input as cpr-numbers in format ddmmyy-xxxx
@ -114,16 +115,18 @@ cpr_dob<-function(cpr){
#' Determine female sex from CPR
#'
#' Just checking if last number of a string is equal or not.
#' @param cpr cpr-numbers as ddmmyy"-."xxxx or ddmmyyxxxx. Also mixed formatting. Vector or data frame column.
#' @param cpr Vector. cpr-numbers as ddmmyy"-."xxxx or ddmmyyxxxx. Also mixed formatting. Vector or data frame column.
#' @keywords cpr
#'
#' @return Logical vector
#' @export
#' @examples
#' cpr_female("231045-0637")
#' data(cprs)
#' cpr_female(cprs[,1])
cpr_female<-function(cpr){
##Input as vector of DK cpr numbers, format "ddmmyy-xxxx", returns sex according to cpr
if (!is.vector(cpr)) stop("Input has to be vector")
x <- nchar(as.character(cpr)) # Formats as character to avoid confusions
as.logical(as.integer(substr(cpr, start = x, stop = x)) %% 2)
as.integer(substr(cpr, start = x, stop = x)) %% 2 == 0
}

12
R/cprs.R Normal file
View File

@ -0,0 +1,12 @@
#' Data frame of 200 cpr numbers
#'
#' This is just a repeated sample of 8 synthesized cpr-numbers for testing purposes.
#'
#' @format A data frame with 200 rows and 1 variable:
#' \describe{
#' \item{cpr}{Mixed format cpr-numbers, characters}
#' }
#' @source \url{https://da.wikipedia.org/wiki/231045-0637/}
#' @usage data(cprs)
"cprs"

View File

@ -1,17 +1,17 @@
utils::globalVariables(c("or","ord","lo","up"))
#' Forrest plot from ordinal logistic regression.
#' Forest plot from ordinal logistic regression.
#'
#' Heavily inspired by https://www.r-bloggers.com/plotting-odds-ratios-aka-a-forrestplot-with-ggplot2/
#'
#' @param x input data.
#' @param title plot title
#' @param dec decimals for labels
#' @param lbls labels for variable names. Carefull, as the right order is not checked automatically!
#' @param lbls labels for variable names. Careful, as the right order is not checked automatically!
#' @param hori labels the horizontal axis (this i the y axis as the plot is rotated)
#' @param vert labels the horizontal axis (this i the x axis as the plot is rotated)
#' @param short flag to half number of ticks on horizontal axis.
#' @param input can be either "model", which is a olr model (polr()), or "df", which is a dataframe whith three columns for OR, lower CI and upper CI.
#' @param input can be either "model", which is a olr model (polr()), or "df", which is a data frame with three columns for OR, lower CI and upper CI.
#'
#' @return gg object
#' @keywords forest plot

View File

@ -10,4 +10,4 @@ Please use the package or grab bits of the functions. Mind the licensing.
# GitHub
This package is [shared on GitHub](https://github.com/agdamsbo/stRoke), and you are very wellcome to contribute by opening an issue or a pull request.
This package is [shared on GitHub](https://github.com/agdamsbo/stRoke), and you are very welcome to contribute by opening an issue or a pull request.

6
data-raw/cprs.R Normal file
View File

@ -0,0 +1,6 @@
## code to prepare `cprs` dataset goes here
usethis::use_data(cprs, overwrite = TRUE)
cprs <- data.frame(cpr=sample(c("2310450637", "010115-4000", "0101896000","010189-3000","300450-1030","010150-4021","011085-AKE3","0101EJ-ATW3"),200,TRUE))
save(cprs,file="cprs.rda")

View File

@ -1,200 +0,0 @@
011085-AKE3
2310450637
2310450637
0101EJ-ATW3
0101896000
010189-3000
2310450637
300450-1030
0101EJ-ATW3
2310450637
010115-4000
0101EJ-ATW3
010150-4021
0101896000
300450-1030
010189-3000
010150-4021
010189-3000
010150-4021
010115-4000
0101896000
300450-1030
010189-3000
011085-AKE3
010115-4000
011085-AKE3
010189-3000
2310450637
0101896000
010115-4000
010150-4021
300450-1030
300450-1030
011085-AKE3
0101EJ-ATW3
010189-3000
2310450637
0101EJ-ATW3
010115-4000
0101EJ-ATW3
0101896000
0101896000
0101896000
0101896000
010115-4000
010189-3000
300450-1030
0101EJ-ATW3
010150-4021
0101896000
2310450637
010189-3000
2310450637
0101EJ-ATW3
300450-1030
010115-4000
0101EJ-ATW3
011085-AKE3
010115-4000
300450-1030
010150-4021
010189-3000
010150-4021
010189-3000
2310450637
010115-4000
300450-1030
010189-3000
0101EJ-ATW3
010189-3000
011085-AKE3
0101896000
010189-3000
300450-1030
2310450637
0101896000
300450-1030
010150-4021
011085-AKE3
2310450637
300450-1030
300450-1030
300450-1030
011085-AKE3
010189-3000
010189-3000
010115-4000
300450-1030
010115-4000
300450-1030
011085-AKE3
0101896000
300450-1030
2310450637
011085-AKE3
010115-4000
0101EJ-ATW3
300450-1030
0101EJ-ATW3
300450-1030
0101EJ-ATW3
010115-4000
0101EJ-ATW3
010189-3000
010189-3000
2310450637
0101896000
300450-1030
2310450637
300450-1030
0101EJ-ATW3
0101EJ-ATW3
2310450637
0101EJ-ATW3
010150-4021
2310450637
300450-1030
010115-4000
010189-3000
300450-1030
0101EJ-ATW3
010115-4000
0101EJ-ATW3
2310450637
011085-AKE3
011085-AKE3
300450-1030
0101896000
011085-AKE3
2310450637
010189-3000
0101896000
300450-1030
0101896000
010189-3000
300450-1030
011085-AKE3
0101896000
010189-3000
010150-4021
0101896000
2310450637
0101EJ-ATW3
0101EJ-ATW3
010150-4021
011085-AKE3
011085-AKE3
010150-4021
0101EJ-ATW3
300450-1030
0101896000
300450-1030
010189-3000
010115-4000
010150-4021
0101896000
010115-4000
300450-1030
010189-3000
0101EJ-ATW3
010189-3000
2310450637
010189-3000
0101896000
300450-1030
0101EJ-ATW3
0101EJ-ATW3
2310450637
010189-3000
010189-3000
2310450637
2310450637
010150-4021
010115-4000
2310450637
011085-AKE3
010150-4021
010189-3000
2310450637
010189-3000
010115-4000
300450-1030
0101896000
011085-AKE3
010150-4021
010189-3000
300450-1030
0101EJ-ATW3
2310450637
010189-3000
011085-AKE3
2310450637
0101EJ-ATW3
010115-4000
0101896000
0101896000
300450-1030
0101896000
0101896000
010115-4000
1 011085-AKE3
2 2310450637
3 2310450637
4 0101EJ-ATW3
5 0101896000
6 010189-3000
7 2310450637
8 300450-1030
9 0101EJ-ATW3
10 2310450637
11 010115-4000
12 0101EJ-ATW3
13 010150-4021
14 0101896000
15 300450-1030
16 010189-3000
17 010150-4021
18 010189-3000
19 010150-4021
20 010115-4000
21 0101896000
22 300450-1030
23 010189-3000
24 011085-AKE3
25 010115-4000
26 011085-AKE3
27 010189-3000
28 2310450637
29 0101896000
30 010115-4000
31 010150-4021
32 300450-1030
33 300450-1030
34 011085-AKE3
35 0101EJ-ATW3
36 010189-3000
37 2310450637
38 0101EJ-ATW3
39 010115-4000
40 0101EJ-ATW3
41 0101896000
42 0101896000
43 0101896000
44 0101896000
45 010115-4000
46 010189-3000
47 300450-1030
48 0101EJ-ATW3
49 010150-4021
50 0101896000
51 2310450637
52 010189-3000
53 2310450637
54 0101EJ-ATW3
55 300450-1030
56 010115-4000
57 0101EJ-ATW3
58 011085-AKE3
59 010115-4000
60 300450-1030
61 010150-4021
62 010189-3000
63 010150-4021
64 010189-3000
65 2310450637
66 010115-4000
67 300450-1030
68 010189-3000
69 0101EJ-ATW3
70 010189-3000
71 011085-AKE3
72 0101896000
73 010189-3000
74 300450-1030
75 2310450637
76 0101896000
77 300450-1030
78 010150-4021
79 011085-AKE3
80 2310450637
81 300450-1030
82 300450-1030
83 300450-1030
84 011085-AKE3
85 010189-3000
86 010189-3000
87 010115-4000
88 300450-1030
89 010115-4000
90 300450-1030
91 011085-AKE3
92 0101896000
93 300450-1030
94 2310450637
95 011085-AKE3
96 010115-4000
97 0101EJ-ATW3
98 300450-1030
99 0101EJ-ATW3
100 300450-1030
101 0101EJ-ATW3
102 010115-4000
103 0101EJ-ATW3
104 010189-3000
105 010189-3000
106 2310450637
107 0101896000
108 300450-1030
109 2310450637
110 300450-1030
111 0101EJ-ATW3
112 0101EJ-ATW3
113 2310450637
114 0101EJ-ATW3
115 010150-4021
116 2310450637
117 300450-1030
118 010115-4000
119 010189-3000
120 300450-1030
121 0101EJ-ATW3
122 010115-4000
123 0101EJ-ATW3
124 2310450637
125 011085-AKE3
126 011085-AKE3
127 300450-1030
128 0101896000
129 011085-AKE3
130 2310450637
131 010189-3000
132 0101896000
133 300450-1030
134 0101896000
135 010189-3000
136 300450-1030
137 011085-AKE3
138 0101896000
139 010189-3000
140 010150-4021
141 0101896000
142 2310450637
143 0101EJ-ATW3
144 0101EJ-ATW3
145 010150-4021
146 011085-AKE3
147 011085-AKE3
148 010150-4021
149 0101EJ-ATW3
150 300450-1030
151 0101896000
152 300450-1030
153 010189-3000
154 010115-4000
155 010150-4021
156 0101896000
157 010115-4000
158 300450-1030
159 010189-3000
160 0101EJ-ATW3
161 010189-3000
162 2310450637
163 010189-3000
164 0101896000
165 300450-1030
166 0101EJ-ATW3
167 0101EJ-ATW3
168 2310450637
169 010189-3000
170 010189-3000
171 2310450637
172 2310450637
173 010150-4021
174 010115-4000
175 2310450637
176 011085-AKE3
177 010150-4021
178 010189-3000
179 2310450637
180 010189-3000
181 010115-4000
182 300450-1030
183 0101896000
184 011085-AKE3
185 010150-4021
186 010189-3000
187 300450-1030
188 0101EJ-ATW3
189 2310450637
190 010189-3000
191 011085-AKE3
192 2310450637
193 0101EJ-ATW3
194 010115-4000
195 0101896000
196 0101896000
197 300450-1030
198 0101896000
199 0101896000
200 010115-4000

BIN
data/cprs.rda Normal file

Binary file not shown.

View File

@ -64,7 +64,7 @@ Please use the package or grab bits of the functions. Mind the licensing.</p>
<div class="section level1">
<h1 id="github">GitHub<a class="anchor" aria-label="anchor" href="#github"></a>
</h1>
<p>This package is <a href="https://github.com/agdamsbo/stRoke" class="external-link">shared on GitHub</a>, and you are very wellcome to contribute by opening an issue or a pull request.</p>
<p>This package is <a href="https://github.com/agdamsbo/stRoke" class="external-link">shared on GitHub</a>, and you are very welcome to contribute by opening an issue or a pull request.</p>
</div>
</main><aside class="col-md-3"><div class="license">

View File

@ -2,5 +2,5 @@ pandoc: 2.19.2
pkgdown: 2.0.6
pkgdown_sha: ~
articles: {}
last_built: 2022-09-23T17:08Z
last_built: 2022-09-26T11:58Z

View File

@ -60,11 +60,15 @@
<div class="section level2">
<h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="va">fsd</span><span class="op">&lt;-</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"2310450637"</span>, <span class="st">"010115-4000"</span>, <span class="st">"0101896000"</span>,<span class="st">"010189-3000"</span>,<span class="st">"300450-1030"</span>,<span class="st">"010150-4021"</span><span class="op">)</span></span></span>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="va">fsd</span><span class="op">&lt;-</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"2310450637"</span>, <span class="st">"010190-2000"</span>, <span class="st">"010115-4000"</span>,<span class="st">"300450-1030"</span>,<span class="st">"010150-4021"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu">cpr_check</span><span class="op">(</span><span class="st">"2310450637"</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OBS: according to new description, not all valid CPR numbers apply to this modulus 11 rule. </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Please refer to: https://cpr.dk/media/12066/personnummeret-i-cpr.pdf</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] TRUE</span>
<span class="r-in"><span><span class="fu">cpr_check</span><span class="op">(</span><span class="va">fsd</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OBS: according to new description, not all valid CPR numbers apply to this modulus 11 rule. </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Please refer to: https://cpr.dk/media/12066/personnummeret-i-cpr.pdf</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] TRUE FALSE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] TRUE FALSE FALSE FALSE FALSE</span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/all.html" class="external-link">all</a></span><span class="op">(</span><span class="fu">cpr_check</span><span class="op">(</span><span class="va">fsd</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> OBS: according to new description, not all valid CPR numbers apply to this modulus 11 rule. </span>
<span class="r-msg co"><span class="r-pr">#&gt;</span> Please refer to: https://cpr.dk/media/12066/personnummeret-i-cpr.pdf</span>

View File

@ -1,5 +1,5 @@
<!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, shrink-to-fit=no"><meta name="description" content="For easy calculation."><title>Extracting date of birth from CPR — cpr_dob • stRoke</title><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.1.3/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.1.3/bootstrap.bundle.min.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"><!-- bootstrap-toc --><script src="https://cdn.rawgit.com/afeld/bootstrap-toc/v1.0.1/dist/bootstrap-toc.min.js"></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><!-- 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><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Extracting date of birth from CPR — cpr_dob"><meta property="og:description" content="For easy calculation."><!-- 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]>
<!-- 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, shrink-to-fit=no"><meta name="description" content="For easy calculation. Does not handle cprs with letters (interim cpr)"><title>Extracting date of birth from CPR — cpr_dob • stRoke</title><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.1.3/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.1.3/bootstrap.bundle.min.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"><!-- bootstrap-toc --><script src="https://cdn.rawgit.com/afeld/bootstrap-toc/v1.0.1/dist/bootstrap-toc.min.js"></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><!-- 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><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Extracting date of birth from CPR — cpr_dob"><meta property="og:description" content="For easy calculation. Does not handle cprs with letters (interim cpr)"><!-- 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>
@ -37,7 +37,7 @@
</div>
<div class="ref-description section level2">
<p>For easy calculation.</p>
<p>For easy calculation. Does not handle cprs with letters (interim cpr)</p>
</div>
<div class="section level2">
@ -62,10 +62,9 @@
<h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="fu">cpr_dob</span><span class="op">(</span><span class="st">"231045-0637"</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] "1945-10-23"</span>
<span class="r-in"><span><span class="va">fsd</span><span class="op">&lt;-</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"010190-2000"</span>, <span class="st">"010115-4000"</span>, <span class="st">"0101896000"</span>,<span class="st">"010189-3000"</span>,<span class="st">"300450-1030"</span>,<span class="st">"010150-4021"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">fsd</span><span class="op">&lt;-</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"2310450637"</span>, <span class="st">"010190-2000"</span>, <span class="st">"010115-4000"</span>,<span class="st">"300450-1030"</span>,<span class="st">"010150-4021"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu">cpr_dob</span><span class="op">(</span><span class="va">fsd</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] "1990-01-01" "2015-01-01" "1889-01-01" "1989-01-01" "1950-04-30"</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [6] "1950-01-01"</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] "1945-10-23" "1990-01-01" "2015-01-01" "1950-04-30" "1950-01-01"</span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>

View File

@ -48,7 +48,7 @@
<div class="section level2">
<h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>
<dl><dt>cpr</dt>
<dd><p>cpr-numbers as ddmmyy"-."xxxx or ddmmyyxxxx. Also mixed formatting. Vector or data frame column.</p></dd>
<dd><p>Vector. cpr-numbers as ddmmyy"-."xxxx or ddmmyyxxxx. Also mixed formatting. Vector or data frame column.</p></dd>
</dl></div>
<div class="section level2">
@ -60,8 +60,25 @@
<div class="section level2">
<h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="fu">cpr_female</span><span class="op">(</span><span class="st">"231045-0637"</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] TRUE</span>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/utils/data.html" class="external-link">data</a></span><span class="op">(</span><span class="va">cprs</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu">cpr_female</span><span class="op">(</span><span class="va">cprs</span><span class="op">[</span>,<span class="fl">1</span><span class="op">]</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] FALSE FALSE FALSE TRUE TRUE FALSE FALSE FALSE FALSE TRUE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [13] TRUE TRUE FALSE FALSE TRUE FALSE TRUE FALSE TRUE FALSE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [25] TRUE TRUE FALSE TRUE TRUE TRUE FALSE TRUE FALSE FALSE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [37] TRUE TRUE FALSE FALSE FALSE FALSE TRUE TRUE FALSE FALSE TRUE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [49] FALSE TRUE FALSE FALSE TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [61] FALSE FALSE FALSE FALSE TRUE TRUE TRUE FALSE TRUE TRUE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [73] TRUE FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE TRUE TRUE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [85] TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [97] TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE TRUE TRUE FALSE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [109] TRUE TRUE TRUE TRUE TRUE FALSE FALSE TRUE FALSE TRUE TRUE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [121] TRUE TRUE FALSE TRUE FALSE TRUE TRUE TRUE FALSE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [133] FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE FALSE TRUE FALSE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [145] TRUE TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [157] TRUE FALSE FALSE FALSE FALSE TRUE FALSE TRUE FALSE TRUE TRUE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [169] TRUE TRUE FALSE FALSE FALSE TRUE FALSE FALSE TRUE TRUE TRUE TRUE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [181] FALSE FALSE TRUE TRUE TRUE TRUE FALSE TRUE FALSE FALSE TRUE FALSE</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [193] TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE</span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>

79
docs/reference/cprs.html Normal file
View File

@ -0,0 +1,79 @@
<!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, shrink-to-fit=no"><meta name="description" content="This is just a repeated sample of 8 synthesized cpr-numbers for testing purposes."><title>Data frame of 200 cpr numbers — cprs • stRoke</title><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.1.3/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.1.3/bootstrap.bundle.min.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"><!-- bootstrap-toc --><script src="https://cdn.rawgit.com/afeld/bootstrap-toc/v1.0.1/dist/bootstrap-toc.min.js"></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><!-- 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><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Data frame of 200 cpr numbers — cprs"><meta property="og:description" content="This is just a repeated sample of 8 synthesized cpr-numbers for testing purposes."><!-- 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>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar fixed-top navbar-light navbar-expand-lg bg-light"><div class="container">
<a class="navbar-brand me-2" href="../index.html">stRoke</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">0.22.9.2</small>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar" class="collapse navbar-collapse ms-3">
<ul class="navbar-nav me-auto"><li class="active nav-item">
<a class="nav-link" href="../reference/index.html">Reference</a>
</li>
</ul><form class="form-inline my-2 my-lg-0" role="search">
<input type="search" class="form-control me-sm-2" aria-label="Toggle navigation" name="search-input" data-search-index="../search.json" id="search-input" placeholder="Search for" autocomplete="off"></form>
<ul class="navbar-nav"></ul></div>
</div>
</nav><div class="container template-reference-topic">
<div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="" class="logo" alt=""><h1>Data frame of 200 cpr numbers</h1>
<div class="d-none name"><code>cprs.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>This is just a repeated sample of 8 synthesized cpr-numbers for testing purposes.</p>
</div>
<div class="section level2">
<h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu"><a href="https://rdrr.io/r/utils/data.html" class="external-link">data</a></span><span class="op">(</span><span class="va">cprs</span><span class="op">)</span></span></code></pre></div>
</div>
<div class="section level2">
<h2 id="format">Format<a class="anchor" aria-label="anchor" href="#format"></a></h2>
<p>A data frame with 200 rows and 1 variable:</p><dl><dt>cpr</dt>
<dd><p>Mixed format cpr-numbers, characters</p></dd>
</dl></div>
<div class="section level2">
<h2 id="source">Source<a class="anchor" aria-label="anchor" href="#source"></a></h2>
<p><a href="https://da.wikipedia.org/wiki/231045-0637/" class="external-link">https://da.wikipedia.org/wiki/231045-0637/</a></p>
</div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>
</nav></aside></div>
<footer><div class="pkgdown-footer-left">
<p></p><p>Developed by Andreas Gammelgaard Damsbo.</p>
</div>
<div class="pkgdown-footer-right">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.6.</p>
</div>
</footer></div>
</body></html>

View File

@ -67,9 +67,14 @@
<dd>Determine female sex from CPR</dd>
</dl><dl><dt>
<code><a href="cprs.html">cprs</a></code>
</dt>
<dd>Data frame of 200 cpr numbers</dd>
</dl><dl><dt>
<code><a href="plot_olr.html">plot_olr()</a></code>
</dt>
<dd>Forrest plot from ordinal logistic regression.</dd>
<dd>Forest plot from ordinal logistic regression.</dd>
</dl><dl><dt>
<code><a href="quantile_cut.html">quantile_cut()</a></code>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 89 KiB

View File

@ -1,5 +1,5 @@
<!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, shrink-to-fit=no"><meta name="description" content="Heavily inspired by https://www.r-bloggers.com/plotting-odds-ratios-aka-a-forrestplot-with-ggplot2/"><title>Forrest plot from ordinal logistic regression. — plot_olr • stRoke</title><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.1.3/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.1.3/bootstrap.bundle.min.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"><!-- bootstrap-toc --><script src="https://cdn.rawgit.com/afeld/bootstrap-toc/v1.0.1/dist/bootstrap-toc.min.js"></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><!-- 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><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Forrest plot from ordinal logistic regression. — plot_olr"><meta property="og:description" content="Heavily inspired by https://www.r-bloggers.com/plotting-odds-ratios-aka-a-forrestplot-with-ggplot2/"><!-- 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]>
<!-- 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, shrink-to-fit=no"><meta name="description" content="Heavily inspired by https://www.r-bloggers.com/plotting-odds-ratios-aka-a-forrestplot-with-ggplot2/"><title>Forest plot from ordinal logistic regression. — plot_olr • stRoke</title><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.1.3/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.1.3/bootstrap.bundle.min.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"><!-- bootstrap-toc --><script src="https://cdn.rawgit.com/afeld/bootstrap-toc/v1.0.1/dist/bootstrap-toc.min.js"></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><!-- 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><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Forest plot from ordinal logistic regression. — plot_olr"><meta property="og:description" content="Heavily inspired by https://www.r-bloggers.com/plotting-odds-ratios-aka-a-forrestplot-with-ggplot2/"><!-- 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>
@ -31,7 +31,7 @@
</nav><div class="container template-reference-topic">
<div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="" class="logo" alt=""><h1>Forrest plot from ordinal logistic regression.</h1>
<img src="" class="logo" alt=""><h1>Forest plot from ordinal logistic regression.</h1>
<div class="d-none name"><code>plot_olr.Rd</code></div>
</div>
@ -69,7 +69,7 @@
<dt>lbls</dt>
<dd><p>labels for variable names. Carefull, as the right order is not checked automatically!</p></dd>
<dd><p>labels for variable names. Careful, as the right order is not checked automatically!</p></dd>
<dt>hori</dt>
@ -85,7 +85,7 @@
<dt>input</dt>
<dd><p>can be either "model", which is a olr model (polr()), or "df", which is a dataframe whith three columns for OR, lower CI and upper CI.</p></dd>
<dd><p>can be either "model", which is a olr model (polr()), or "df", which is a data frame with three columns for OR, lower CI and upper CI.</p></dd>
</dl></div>
<div class="section level2">

View File

@ -101,8 +101,8 @@
<span class="r-in"><span><span class="va">x</span> <span class="op">&lt;-</span> <span class="fl">1</span><span class="op">:</span><span class="fl">450</span></span></span>
<span class="r-in"><span><span class="va">y</span> <span class="op">&lt;-</span> <span class="fl">6</span><span class="op">:</span><span class="fl">750</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="fu">quantile_cut</span><span class="op">(</span><span class="va">aa</span>,groups<span class="op">=</span><span class="fl">4</span>,detail.list<span class="op">=</span><span class="cn">FALSE</span><span class="op">)</span><span class="op">)</span> <span class="co">## Cuts quartiles</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1,249] (249,496] (496,747] (747,1e+03] </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 500 502 500 498 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1,236] (236,490] (490,751] (751,1e+03] </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 502 498 501 499 </span>
</code></pre></div>
</div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>

File diff suppressed because one or more lines are too long

View File

@ -24,6 +24,9 @@
<url>
<loc>/reference/cpr_female.html</loc>
</url>
<url>
<loc>/reference/cprs.html</loc>
</url>
<url>
<loc>/reference/index.html</loc>
</url>

View File

@ -1,5 +1,7 @@
Andreas
CMD
Gammelgaard
NA's
ORCID
Vectorised
agdamsbo
@ -7,5 +9,13 @@ cpr
daDoctoR
ddmmyy
ddmmyyxxxx
df
forrestplot
gg
ggplot
https
olr
polr
www
xxxx
yyyy

View File

@ -16,7 +16,8 @@ Logical vector of cpr validity
Checking validity of cpr number. Vectorised.
}
\examples{
fsd<-c("2310450637", "010115-4000", "0101896000","010189-3000","300450-1030","010150-4021")
fsd<-c("2310450637", "010190-2000", "010115-4000","300450-1030","010150-4021")
cpr_check("2310450637")
cpr_check(fsd)
all(cpr_check(fsd))
}

View File

@ -13,11 +13,11 @@ cpr_dob(cpr)
vector of Date elements. Format yyyy-mm-dd
}
\description{
For easy calculation.
For easy calculation. Does not handle cprs with letters (interim cpr)
}
\examples{
cpr_dob("231045-0637")
fsd<-c("010190-2000", "010115-4000", "0101896000","010189-3000","300450-1030","010150-4021")
fsd<-c("2310450637", "010190-2000", "010115-4000","300450-1030","010150-4021")
cpr_dob(fsd)
}
\keyword{cpr}

View File

@ -7,7 +7,7 @@
cpr_female(cpr)
}
\arguments{
\item{cpr}{cpr-numbers as ddmmyy"-."xxxx or ddmmyyxxxx. Also mixed formatting. Vector or data frame column.}
\item{cpr}{Vector. cpr-numbers as ddmmyy"-."xxxx or ddmmyyxxxx. Also mixed formatting. Vector or data frame column.}
}
\value{
Logical vector
@ -16,6 +16,7 @@ Logical vector
Just checking if last number of a string is equal or not.
}
\examples{
cpr_female("231045-0637")
data(cprs)
cpr_female(cprs[,1])
}
\keyword{cpr}

22
man/cprs.Rd Normal file
View File

@ -0,0 +1,22 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cprs.R
\docType{data}
\name{cprs}
\alias{cprs}
\title{Data frame of 200 cpr numbers}
\format{
A data frame with 200 rows and 1 variable:
\describe{
\item{cpr}{Mixed format cpr-numbers, characters}
}
}
\source{
\url{https://da.wikipedia.org/wiki/231045-0637/}
}
\usage{
data(cprs)
}
\description{
This is just a repeated sample of 8 synthesized cpr-numbers for testing purposes.
}
\keyword{datasets}

View File

@ -2,7 +2,7 @@
% Please edit documentation in R/plot_olr.R
\name{plot_olr}
\alias{plot_olr}
\title{Forrest plot from ordinal logistic regression.}
\title{Forest plot from ordinal logistic regression.}
\usage{
plot_olr(
x,
@ -22,7 +22,7 @@ plot_olr(
\item{dec}{decimals for labels}
\item{lbls}{labels for variable names. Carefull, as the right order is not checked automatically!}
\item{lbls}{labels for variable names. Careful, as the right order is not checked automatically!}
\item{hori}{labels the horizontal axis (this i the y axis as the plot is rotated)}
@ -30,7 +30,7 @@ plot_olr(
\item{short}{flag to half number of ticks on horizontal axis.}
\item{input}{can be either "model", which is a olr model (polr()), or "df", which is a dataframe whith three columns for OR, lower CI and upper CI.}
\item{input}{can be either "model", which is a olr model (polr()), or "df", which is a data frame with three columns for OR, lower CI and upper CI.}
}
\value{
gg object

View File

@ -1,26 +1,26 @@
test_that("cpr_check() works for vectors, giving logicals", {
testthat::test_that("cpr_check() works for vectors, giving logicals", {
result <- cpr_check(c("2310450637", "010115-4000", "0101896000","010189-3000","300450-1030","010150-4021"))
expect_equal(any(result), TRUE)
expect_type(result, "logical")
expect_equal(result[2], FALSE)
testthat::expect_equal(any(result), TRUE)
testthat::expect_type(result, "logical")
testthat::expect_equal(result[2], FALSE)
})
################################################################################
test_that("cpr_dob() works for vectors, giving logicals", {
testthat::test_that("cpr_dob() works for vectors, giving logicals", {
result <- cpr_dob(c("2310450637", "010115-4000", "0101896000","010189-3000","300450-1030","010150-4021"))
expect_type(result, "double")
expect_s3_class(result, "Date")
expect_length(result, 6)
testthat::expect_type(result, "double")
testthat::expect_s3_class(result, "Date")
testthat::expect_length(result, 6)
})
################################################################################
test_that("cpr_female() works for vectors, giving logicals", {
testthat::test_that("cpr_female() works for vectors, giving logicals", {
result <- cpr_female(c("2310450637", "010115-4000", "0101896000","010189-3000","300450-1030","010150-4021"))
expect_type(result, "logical")
expect_length(result, 6)
expect_equal(result[2], FALSE)
testthat::expect_type(result, "logical")
testthat::expect_length(result, 6)
testthat::expect_equal(result[2], TRUE)
})
################################################################################