-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
123 lines (90 loc) · 3.12 KB
/
README.Rmd
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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# chartcatalog
<!-- badges: start -->
[](https://github.com/growthcharts/chartcatalog/actions)
[](https://github.com/growthcharts/chartcatalog/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
The `chartcatalog` package contains tools to
- Lookup available charts in JAMES;
- Create and parse chart codes;
- Find outcomes, chart group and growth reference;
- Obtain viewport number and transformation functions;
- Lookup break points from the brokenstick model.
## Installation
You can install the development version `chartcatalog` by
```{r eval = FALSE}
install.packages("remotes")
remotes::install_github("growthcharts/chartcatalog")
```
There is no release on CRAN.
## Example 1: Available charts in JAMES
```{r setup, echo=FALSE, hide=TRUE}
library(chartcatalog)
```
The current catalogs holds `r length(unique(ynames_lookup$chartcode))` Dutch charts.
```{r example}
library(chartcatalog)
head(ynames_lookup)
length(unique(ynames_lookup$chartcode))
```
The charts are subdivided into three groups:
```{r chartgrp}
unique(ynames_lookup$chartgrp)
```
There are five outcomes, but not every outcome (`yname`) appears in all chart groups:
```{r charttable}
with(ynames_lookup, table(chartgrp, yname))
```
## Example 2: Chartcode creating and parsing
A `chartcode` identifies the type of growth chart. The code
is a combination of 4--7 alphanumeric characters. The `create_chartcode()`
and `parse_chartcode()` functions can be used to obtain information
from the codes. For example,
```{r parse}
parse_chartcode(c("HJAA"))
```
shows that chart with code `"HJAA"` identifies the front of the chart for
Hindustan boys living in the Netherlands, design A (A4 size, 0-15 months).
## Example 3: Find outcomes, chart group and growth reference
If we have a chart code, we may find its chart group and outcomes as
```{r getchartgrp}
get_chartgrp("PJEAN26")
get_ynames("PJEAN26")
```
We obtain the call to the `clopus` package to the post-natal growth reference
of weight of preterms born at a gestational age of 26 week by
```{r getcall}
call <- get_reference_call("PJEAN26", yname = "wgt")
call
```
This call can be stored as a shortcut to the reference. Use `eval(parse(text = call))` to execute the call.
Alternatively, if you have `clopus` installed, we may obtain the reference directly by
```{r getref}
tb <- get_reference("PJEAN26", yname = "wgt")
slotNames(tb)
head(data.frame(tb@table@table))
```
More details can be found in the `info` slot:
```{r tbinfo}
tb@info
```
## Added support for `nlreferences` package
```{r}
library(centile)
library(nlreferences)
library(dplyr)
refcode <- get_refcode("PJEAN26", "wgt")
ref <- load_reference(refcode, pkg = "nlreferences", verbose = TRUE)
head(ref)
```