├── vignettes └── .gitignore ├── data ├── davis1974.rda ├── leucht2016.rda ├── leucht2020.rda ├── woods2003.rda ├── gardner2010.rda └── gardner2010_withsai.rda ├── tests ├── testthat.R └── testthat │ ├── test_key.R │ ├── test_checks.R │ ├── test_known_values.R │ └── test_convert.R ├── docs ├── reference │ ├── Rplot001.png │ ├── davis1974.html │ ├── woods2003.html │ ├── leucht2016.html │ ├── leucht2020.html │ ├── gardner2010_withsai.html │ ├── check_key.html │ ├── gardner2010.html │ └── index.html ├── pkgdown.yml ├── articles │ ├── exampletable_files │ │ ├── header-attrs-2.6 │ │ │ └── header-attrs.js │ │ └── header-attrs-2.7 │ │ │ └── header-attrs.js │ ├── walkthrough_files │ │ ├── header-attrs-2.6 │ │ │ └── header-attrs.js │ │ └── header-attrs-2.7 │ │ │ └── header-attrs.js │ └── index.html ├── link.svg ├── bootstrap-toc.css ├── docsearch.js ├── pkgdown.js ├── bootstrap-toc.js ├── 404.html ├── issue_template.html ├── authors.html ├── pull_request_template.html ├── news │ └── index.html └── pkgdown.css ├── .gitignore ├── NAMESPACE ├── inst └── extdata │ ├── woods2003.csv │ ├── davis1974.csv │ ├── leucht2020.csv │ ├── gardner2010.csv │ └── leucht2016.csv ├── .buildconfig ├── codecov.yml ├── .Rbuildignore ├── .github ├── issue_template.md ├── pull_request_template.md ├── CONTRIBUTING.md └── workflows │ └── R-CMD-check.yaml ├── NEWS.md ├── man ├── check_key.Rd ├── davis1974.Rd ├── trim_key.Rd ├── woods2003.Rd ├── add_key.Rd ├── leucht2016.Rd ├── leucht2020.Rd ├── gardner2010_withsai.Rd ├── check_ap.Rd ├── gardner2010.Rd ├── to_cpz.Rd └── to_ap.Rd ├── DESCRIPTION ├── doc └── walkthrough.R ├── codemeta.json ├── R ├── key_functions.R └── key_data.R └── README.md /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /data/davis1974.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/chlorpromazineR/HEAD/data/davis1974.rda -------------------------------------------------------------------------------- /data/leucht2016.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/chlorpromazineR/HEAD/data/leucht2016.rda -------------------------------------------------------------------------------- /data/leucht2020.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/chlorpromazineR/HEAD/data/leucht2020.rda -------------------------------------------------------------------------------- /data/woods2003.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/chlorpromazineR/HEAD/data/woods2003.rda -------------------------------------------------------------------------------- /data/gardner2010.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/chlorpromazineR/HEAD/data/gardner2010.rda -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(chlorpromazineR) 3 | 4 | test_check("chlorpromazineR") 5 | -------------------------------------------------------------------------------- /data/gardner2010_withsai.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/chlorpromazineR/HEAD/data/gardner2010_withsai.rda -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/chlorpromazineR/HEAD/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | doc 2 | Meta 3 | inst/doc 4 | .buildconfig 5 | scratch 6 | ..Rcheck/ 7 | .github/.gitignore 8 | vignettes/.Rhistory 9 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(add_key) 4 | export(check_ap) 5 | export(check_key) 6 | export(to_ap) 7 | export(to_cpz) 8 | export(trim_key) 9 | -------------------------------------------------------------------------------- /inst/extdata/woods2003.csv: -------------------------------------------------------------------------------- 1 | Antipsychotic,CPZ100 2 | chlopromazine,100 3 | haloperidol,2 4 | risperidone,2 5 | olanzapine,5 6 | quetiapine,75 7 | ziprasidone,60 8 | aripiprazole,7.5 -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 2.11.2 2 | pkgdown: 1.6.1 3 | pkgdown_sha: ~ 4 | articles: 5 | exampletable: exampletable.html 6 | walkthrough: walkthrough.html 7 | last_built: 2021-03-13T22:13Z 8 | 9 | -------------------------------------------------------------------------------- /.buildconfig: -------------------------------------------------------------------------------- 1 | [default] 2 | name=Default 3 | runtime=host 4 | config-opts= 5 | run-opts= 6 | prefix=/home/eric/.cache/gnome-builder/install/chlorpromazineR/host 7 | app-id= 8 | postbuild= 9 | prebuild= 10 | default=true 11 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: auto 8 | threshold: 1% 9 | patch: 10 | default: 11 | target: auto 12 | threshold: 1% 13 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^codecov\.yml$ 2 | ^\.travis\.yml$ 3 | ^README\.md$ 4 | ^chlorpromazineR_proofofconcept\.pdf$ 5 | ^scratch$ 6 | ^paper\.md$ 7 | ^paper\.bib$ 8 | ^Meta$ 9 | ^doc$ 10 | ^docs$ 11 | ^.buildconfig 12 | ^codemeta\.json$ 13 | ^\.github$ 14 | ^CRAN-RELEASE$ 15 | ^cran-comments\.md$ 16 | -------------------------------------------------------------------------------- /inst/extdata/davis1974.csv: -------------------------------------------------------------------------------- 1 | Antipsychotic,CPZ100 2 | Chlorpromazine,100 3 | Triflupromazine,28.4 4 | Thioridazine,95.3 5 | Prochlorperazine,14.3 6 | Perphenazine,8.9 7 | Fluphenazine,1.2 8 | Trifluoperazine,2.8 9 | Acetophenazine,23.5 10 | Carphenazine,24.3 11 | Butaperazine,8.9 12 | Mesoridazine,55.3 13 | Piperacetazine,10.5 14 | Haloperidol,1.6 15 | Chlorprothixene,43.9 16 | Thiothixene,5.2 -------------------------------------------------------------------------------- /inst/extdata/leucht2020.csv: -------------------------------------------------------------------------------- 1 | route,drug,OLZ1mgeq,days 2 | oral,amisulpride,35.39, 3 | oral,aripiprazole,0.76, 4 | LAI,aripiprazole lauroxil,1.09,28 5 | oral,asenapine,0.99, 6 | oral,brexpiprazole,0.22 7 | oral,cariprazine,0.50, 8 | oral,haloperidol,0.42, 9 | oral,iloperidone,1.33, 10 | oral,lurasidone,9.69, 11 | oral,olanzapine,1.00, 12 | LAI,olanzapine,1.31,14 13 | oral,paliperidone,0.88, 14 | LAI,paliperidone,0.63,28 15 | oral,quetiapine,31.78, 16 | oral,risperidone,0.41, 17 | LAI,risperidone,0.17,14 18 | oral,sertindole,1.49, 19 | oral,ziprasidone,12.29, -------------------------------------------------------------------------------- /docs/articles/exampletable_files/header-attrs-2.6/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/exampletable_files/header-attrs-2.7/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/walkthrough_files/header-attrs-2.6/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/walkthrough_files/header-attrs-2.7/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
Session Info 6 | 7 | ```r 8 | 9 | ``` 10 |
11 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # chlorpromazineR 0.1.2 2 | 3 | This is the first CRAN release of the package. The package has just passed peer-review through rOpenSci. It is published in a fully functional state. 4 | 5 | # chlorpromazineR 0.1.3 6 | 7 | ## Major changes 8 | 9 | Added new vignette with examples from each of the keys (references). 10 | 11 | ## Minor changes 12 | 13 | Added additional tests and code cleanup. 14 | 15 | # chlorpromazineR 0.2.0 16 | 17 | ## Major changes 18 | 19 | Added new key: leucht2020 () 20 | 21 | ### Minor changes 22 | 23 | Added additional tests to compare results to spreadsheet by Leucht et al. with similar purpose. 24 | -------------------------------------------------------------------------------- /man/check_key.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/key_functions.R 3 | \name{check_key} 4 | \alias{check_key} 5 | \title{Check whether a conversion key is the expected format} 6 | \usage{ 7 | check_key(key) 8 | } 9 | \arguments{ 10 | \item{key}{the key to check} 11 | } 12 | \value{ 13 | TRUE if the key is valid, otherwise a error is thrown. 14 | } 15 | \description{ 16 | chlorpromazineR uses conversion factors stored in a named list of 3 named 17 | lists. This verifies that the key is in a usable format, which can be helpful 18 | when creating custom keys or modifying included keys. 19 | } 20 | \examples{ 21 | check_key(gardner2010) 22 | } 23 | \seealso{ 24 | Other key functions: 25 | \code{\link{add_key}()}, 26 | \code{\link{trim_key}()} 27 | } 28 | \concept{key functions} 29 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /man/davis1974.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/key_data.R 3 | \docType{data} 4 | \name{davis1974} 5 | \alias{davis1974} 6 | \title{Chlorpromazine equivalent key from Davis 1974 data} 7 | \format{ 8 | A named list of 3 named lists (1 for each route) and each sub-list 9 | contains the conversion factors for each antipsychotic. The 3 top-level lists 10 | are named `oral`, `sai`, and `lai` (route), and the lists they contain have 11 | names corresponding to the antipsychotic, e.g. `olanzapine`. 12 | } 13 | \source{ 14 | John Davis (1974). Dose equivalence of the anti-psychotic drugs. 15 | Journal of Psychiatric Research, 11, 65-69. 16 | 17 | } 18 | \usage{ 19 | davis1974 20 | } 21 | \description{ 22 | A list of antipsychotics and their chlorpromazine equivalent doses, generated 23 | from the following file included with the package: 24 | system.file("extdata", "davis1974.csv", package="chlorpromazineR"). 25 | } 26 | \keyword{datasets} 27 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | ## Description 8 | 9 | 10 | ## Related Issue 11 | 14 | 15 | ## Example 16 | 18 | 19 | 21 | -------------------------------------------------------------------------------- /man/trim_key.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/key_functions.R 3 | \name{trim_key} 4 | \alias{trim_key} 5 | \title{Modify the names in a conversion key to only include the first word} 6 | \usage{ 7 | trim_key(key) 8 | } 9 | \arguments{ 10 | \item{key}{the key to trim} 11 | } 12 | \value{ 13 | the key that was trimmed (a named list of 3 named lists) 14 | } 15 | \description{ 16 | For parenteral (sai) and long-acting/depot (lai) antipsychotics, the name 17 | consists of the usual generic name (such as haloperidol) and a second word 18 | describing the formulation (e.g. haloperidol decanoate). Since to_cpz() and 19 | add_key() require exact matches to work properly, removing the second word 20 | may be required, but should be done with care as it can add ambiguity (e.g. 21 | fluphenazine enanthate and decanoate). 22 | } 23 | \examples{ 24 | trim_key(gardner2010) 25 | } 26 | \seealso{ 27 | Other key functions: 28 | \code{\link{add_key}()}, 29 | \code{\link{check_key}()} 30 | } 31 | \concept{key functions} 32 | -------------------------------------------------------------------------------- /man/woods2003.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/key_data.R 3 | \docType{data} 4 | \name{woods2003} 5 | \alias{woods2003} 6 | \title{Chlorpromazine equivalent key from Woods 2003 data} 7 | \format{ 8 | A named list of 3 named lists (1 for each route) and each sub-list 9 | contains the conversion factors for each antipsychotic. The 3 top-level lists 10 | are named `oral`, `sai`, and `lai` (route), and the lists they contain have 11 | names corresponding to the antipsychotic, e.g. `olanzapine`. 12 | } 13 | \source{ 14 | Scott Woods (2003). Chlorpromazine Equivalent Doses for the Newer 15 | Atypical Antipsychotics. Journal of Clinical Psychiatry. 64(6). 663-667. 16 | 17 | } 18 | \usage{ 19 | woods2003 20 | } 21 | \description{ 22 | A list of antipsychotics and their chlorpromazine equivalent doses, generated 23 | from the following file included with the package: 24 | system.file("extdata", "woods2003.csv", package="chlorpromazineR"). 25 | } 26 | \keyword{datasets} 27 | -------------------------------------------------------------------------------- /man/add_key.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/key_functions.R 3 | \name{add_key} 4 | \alias{add_key} 5 | \title{Combine 2 keys with base key taking precedence} 6 | \usage{ 7 | add_key(base, added, trim, verbose = TRUE) 8 | } 9 | \arguments{ 10 | \item{base}{the base key} 11 | 12 | \item{added}{the key from which other antipsychotics are found to add} 13 | 14 | \item{trim}{TRUE to use trim_key on both the base and added key, needed when 15 | one does not use the full names (e.g. leucht2016).} 16 | 17 | \item{verbose}{If TRUE, added antipsychotic names will be shown in a message} 18 | } 19 | \value{ 20 | a merged key 21 | } 22 | \description{ 23 | Use this to combine 2 keys by using the whole "base" key, and adding any 24 | antipsychotics from the "added" key that are not in the "base" key. 25 | } 26 | \examples{ 27 | add_key(gardner2010, leucht2016, trim = TRUE) 28 | } 29 | \seealso{ 30 | Other key functions: 31 | \code{\link{check_key}()}, 32 | \code{\link{trim_key}()} 33 | } 34 | \concept{key functions} 35 | -------------------------------------------------------------------------------- /man/leucht2016.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/key_data.R 3 | \docType{data} 4 | \name{leucht2016} 5 | \alias{leucht2016} 6 | \title{Chlorpromazine equivalent key from Leucht et al. 2016 data} 7 | \format{ 8 | A named list of 3 named lists (1 for each route) and each sub-list 9 | contains the conversion factors for each antipsychotic. The 3 top-level lists 10 | are named `oral`, `sai`, and `lai` (route), and the lists they contain have 11 | names corresponding to the antipsychotic, e.g. `olanzapine`. 12 | } 13 | \source{ 14 | Leucht, S., Samara, M., Heres, S., & Davis, J. M. (2016). Dose 15 | Equivalents for Antipsychotic Drugs: The DDD Method. Schizophrenia Bulletin, 16 | 42(suppl_1), S90–S94. 17 | } 18 | \usage{ 19 | leucht2016 20 | } 21 | \description{ 22 | A list of antipsychotics and their chlorpromazine equivalent doses, generated 23 | from the following file included with the package: 24 | system.file("extdata", "leucht2016.csv", package="chlorpromazineR"). 25 | } 26 | \keyword{datasets} 27 | -------------------------------------------------------------------------------- /man/leucht2020.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/key_data.R 3 | \docType{data} 4 | \name{leucht2020} 5 | \alias{leucht2020} 6 | \title{Antipsychotic equivalent key from Leucht et al. 2020 data} 7 | \format{ 8 | A named list of 3 named lists (1 for each route) and each sub-list 9 | contains the conversion factors for each antipsychotic. The 3 top-level lists 10 | are named `oral`, `sai`, and `lai` (route), and the lists they contain have 11 | names corresponding to the antipsychotic, e.g. `olanzapine`. 12 | } 13 | \source{ 14 | Leucht, S., Crippa, A., Siafis, S., Patel, M., Orsini, N. & Davis, 15 | J. M. (2020). Dose-Response Meta-Analysis of Antipsychotic Drugs for Acute 16 | Schizophrenia. American Journal of Psychiatry. 117(4). 17 | 18 | } 19 | \usage{ 20 | leucht2020 21 | } 22 | \description{ 23 | A list of antipsychotics and their olanzapine-equivalent doses, generated 24 | from the following file included with the package: 25 | system.file("extdata", "leucht2020.csv", package="chlorpromazineR"). 26 | } 27 | \details{ 28 | This reference does not include chlorpromazine, so the conversion from 29 | leucht2016 is implied (i.e. chlorpromazine = olanzapine * 30). 30 | } 31 | \keyword{datasets} 32 | -------------------------------------------------------------------------------- /man/gardner2010_withsai.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/key_data.R 3 | \docType{data} 4 | \name{gardner2010_withsai} 5 | \alias{gardner2010_withsai} 6 | \title{Chlorpromazine equivalent key from Gardner et al. 2010 data} 7 | \format{ 8 | A named list of 3 named lists (1 for each route) and each sub-list 9 | contains the conversion factors for each antipsychotic. The 3 top-level lists 10 | are named `oral`, `sai`, and `lai` (route), and the lists they contain have 11 | names corresponding to the antipsychotic, e.g. `olanzapine`. 12 | } 13 | \source{ 14 | Gardner, D. M., Murphy, A. L., O’Donnell, H., Centorrino, F., & 15 | Baldessarini, R. J. (2010). International consensus study of antipsychotic 16 | dosing. The American Journal of #' Psychiatry, 167(6), 686–693. 17 | 18 | } 19 | \usage{ 20 | gardner2010_withsai 21 | } 22 | \description{ 23 | A list of antipsychotics and their chlorpromazine equivalent doses, generated 24 | from the following file included with the package: 25 | system.file("extdata", "gardner2010.csv", package="chlorpromazineR"). 26 | } 27 | \details{ 28 | The SAI equivalents produced by this key are equivalent to chlorpromazine SAI 29 | not oral. They could be manually converted. 30 | } 31 | \keyword{datasets} 32 | -------------------------------------------------------------------------------- /man/check_ap.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/convert.R 3 | \name{check_ap} 4 | \alias{check_ap} 5 | \title{Checks whether antipsychotic names are in the key} 6 | \usage{ 7 | check_ap( 8 | input_data, 9 | key = chlorpromazineR::gardner2010, 10 | ap_label, 11 | route, 12 | route_label 13 | ) 14 | } 15 | \arguments{ 16 | \item{input_data}{data.frame with antipsychotic name and dose data} 17 | 18 | \item{key}{source of the conversion factors--defaults to Gardner et al. 2010} 19 | 20 | \item{ap_label}{column in x that stores antipsychotic name} 21 | 22 | \item{route}{options include "oral", "sai", "lai" or "mixed"} 23 | 24 | \item{route_label}{if "mixed" route is specified, provide the column that 25 | stores the route information} 26 | } 27 | \value{ 28 | number of antipsychotic names in x[,ap_label] that don't match key 29 | } 30 | \description{ 31 | Provided a data.frame, x, this checks that the antipsychotic names stored in 32 | the x's variable ap_label are present in the key. 33 | } 34 | \examples{ 35 | participant_ID <- c("P01", "P02", "P03", "P04") 36 | age <- c(42, 29, 30, 60) # not used in calculation, just shows other data 37 | # can exist in the data.frame 38 | antipsychotic <- c("olanzapine", "olanzapine", "quetiapine", "ziprasidone") 39 | dose <- c(10, 12.5, 300, 60) 40 | example_oral <- data.frame(participant_ID, age, antipsychotic, dose, 41 | stringsAsFactors = FALSE) 42 | check_ap(example_oral, ap_label = "antipsychotic", route = "oral", 43 | key = gardner2010) 44 | } 45 | \concept{checking functions} 46 | -------------------------------------------------------------------------------- /man/gardner2010.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/key_data.R 3 | \docType{data} 4 | \name{gardner2010} 5 | \alias{gardner2010} 6 | \title{Chlorpromazine equivalent key from Gardner et al. 2010 data} 7 | \format{ 8 | A named list of 3 named lists (1 for each route) and each sub-list 9 | contains the conversion factors for each antipsychotic. The 3 top-level lists 10 | are named `oral`, `sai`, and `lai` (route), and the lists they contain have 11 | names corresponding to the antipsychotic, e.g. `olanzapine`. 12 | } 13 | \source{ 14 | Gardner, D. M., Murphy, A. L., O’Donnell, H., Centorrino, F., & 15 | Baldessarini, R. J. (2010). International consensus study of antipsychotic 16 | dosing. The American Journal of Psychiatry, 167(6), 686–693. 17 | 18 | } 19 | \usage{ 20 | gardner2010 21 | } 22 | \description{ 23 | A list of antipsychotics and their chlorpromazine equivalent doses, generated 24 | from the following file included with the package: 25 | system.file("extdata", "gardner2010.csv", package="chlorpromazineR"). 26 | } 27 | \details{ 28 | The SAI data is not included in this key, because the original study did not 29 | specify a conversion factor from chlorpromazine LAI to oral. The alternative 30 | key gardner2010_withsai can be used, which includes the SAI data, but the 31 | chlorpromazine equivalent doses produced are equivalent to chlorpromazine SAI 32 | not chlorpromazine oral. They could be manually converted (e.g. by 33 | multiplying the SAI doses by 3 per equivalence noted by Davis 1974 34 | ) 35 | } 36 | \keyword{datasets} 37 | -------------------------------------------------------------------------------- /inst/extdata/gardner2010.csv: -------------------------------------------------------------------------------- 1 | route,drug,median,days 2 | oral,Chlorpromazine,600, 3 | oral,Amisulpride,700, 4 | oral,Aripiprazole,30, 5 | oral,Benperidol,5, 6 | oral,Clopenthixol,60, 7 | oral,Clorprothixene,500, 8 | oral,Clotiapine,100, 9 | oral,Clozapine,400, 10 | oral,Droperidol,10, 11 | oral,Flupenthixol,10, 12 | oral,Fluphenazine,12, 13 | oral,Haloperidol,10, 14 | oral,Levomepromazine,400, 15 | oral,Loxapine,60, 16 | oral,Mesoridazine,300, 17 | oral,Methotrimeprazine,300, 18 | oral,Molindone,100, 19 | oral,Olanzapine,20, 20 | oral,Oxypertine,240, 21 | oral,Paliperidone,9, 22 | oral,Pericyazine,50, 23 | oral,Perphenazine,30, 24 | oral,Pimozide,8, 25 | oral,Prochlorperazine,88, 26 | oral,Quetiapine,750, 27 | oral,Remoxipride,212, 28 | oral,Risperidone,6, 29 | oral,Sertindole,20, 30 | oral,Sulpiride,800, 31 | oral,Thioridazine,500, 32 | oral,Thiothixene,30, 33 | oral,Trifluoperazine,20, 34 | oral,Trifluperidol,2, 35 | oral,Triflupromazine,100, 36 | oral,Ziprasidone,160, 37 | oral,Zotepine,300, 38 | oral,Zuclopenthixol,50, 39 | SAI,Chlorpromazine HCl,100, 40 | SAI,Clotiapine injectable,40, 41 | SAI,Fluphenazine HCl,5, 42 | SAI,Haloperidol lactate,5, 43 | SAI,Loxapine HCl,25, 44 | SAI,Mesoridazine besylate,100, 45 | SAI,Olanzapine tartrate,10, 46 | SAI,Perphenazine USP,10, 47 | SAI,Prochlorperazine mesylate,22, 48 | SAI,Promazine HCl,100, 49 | SAI,Trifluoperazine HCl,5, 50 | SAI,Triflupromazine HCl,60, 51 | SAI,Ziprasidone mesylate,20, 52 | SAI,Zuclopenthixol acetate,50, 53 | LAI,Clopenthixol decanoate,300,14 54 | LAI,Flupenthixol decanoate,40,14 55 | LAI,Fluphenazine decanoate,25,14 56 | LAI,Fluphenazine enanthate,25,14 57 | LAI,Fluspirilene,6,7 58 | LAI,Haloperidol decanoate,150,28 59 | LAI,Perphenazine enanthate,100,14 60 | LAI,Pipotiazine palmitate,100,28 61 | LAI,Risperidone microspheres,50,14 62 | LAI,Zuclopenthixol decanoate,200,14 -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: chlorpromazineR 2 | Title: Convert Antipsychotic Doses to Chlorpromazine Equivalents 3 | Version: 0.2.0 4 | Authors@R: 5 | c(person("Eric", "Brown", 6 | role = c("aut", "cre"), 7 | email = "eb@ericebrown.com", 8 | comment = c(ORCID = "0000-0002-1575-2606")), 9 | person("Parita", "Shah", 10 | role = "aut", 11 | comment = c(ORCID = "0000-0002-7302-0411")), 12 | person("Julia", "Kim", 13 | role = "aut", 14 | comment = c(ORCID = "0000-0002-0379-1333")), 15 | person("Frederick", "Boehm", 16 | role = "rev", 17 | comment = c(ORCID = "0000-0002-1644-5931"))) 18 | Description: As different antipsychotic medications have different potencies, 19 | the doses of different medications cannot be directly compared. Various 20 | strategies are used to convert doses into a common reference so that 21 | comparison is meaningful. Chlorpromazine (CPZ) has historically been used 22 | as a reference medication into which other antipsychotic doses can be 23 | converted, as "chlorpromazine-equivalent doses". Using conversion keys 24 | generated from widely-cited scientific papers, e.g. Gardner et. al 2010 25 | and Leucht et al. 2016 26 | , antipsychotic doses are converted 27 | to CPZ (or any specified antipsychotic) equivalents. The use of the package 28 | is described in the included vignette. Not for clinical use. 29 | URL: https://docs.ropensci.org/chlorpromazineR/, https://github.com/ropensci/chlorpromazineR 30 | BugReports: https://github.com/ropensci/chlorpromazineR/issues 31 | Depends: R (>= 3.5) 32 | License: GPL-3 33 | Encoding: UTF-8 34 | LazyData: true 35 | RoxygenNote: 7.1.1 36 | Suggests: 37 | knitr, 38 | rmarkdown, 39 | testthat, 40 | covr 41 | VignetteBuilder: knitr 42 | -------------------------------------------------------------------------------- /tests/testthat/test_key.R: -------------------------------------------------------------------------------- 1 | # chlorpromazineR package 2 | # See README.md 3 | # test_key.R 4 | 5 | context("checking key manipulation functions") 6 | 7 | test_that("trim_key() works with gardner2010 data", { 8 | 9 | trimmed <- trim_key(gardner2010_withsai) 10 | 11 | original_sai <- c("chlorpromazine hcl", "clotiapine injectable", 12 | "fluphenazine hcl", "haloperidol lactate", "loxapine hcl") 13 | 14 | expected_sai <- c("chlorpromazine", "clotiapine", "fluphenazine", 15 | "haloperidol", "loxapine") 16 | 17 | original_lai <- c("clopenthixol decanoate", "flupenthixol decanoate", 18 | "fluphenazine decanoate", "fluphenazine enanthate", 19 | "fluspirilene") 20 | 21 | expected_lai <- c("clopenthixol", "flupenthixol", "fluphenazine", 22 | "fluphenazine", "fluspirilene") 23 | 24 | expect_equal(names(gardner2010_withsai$sai)[1:5], original_sai) 25 | expect_equal(names(trimmed$sai)[1:5], expected_sai) 26 | expect_equal(names(gardner2010_withsai$lai)[1:5], original_lai) 27 | expect_equal(names(trimmed$lai)[1:5], expected_lai) 28 | }) 29 | 30 | test_that("add_key() works with gardner2010 and leucht2016", { 31 | 32 | merged <- add_key(gardner2010, leucht2016, trim=TRUE) 33 | 34 | expect_equal(merged$oral$haloperidol, gardner2010$oral$haloperidol) 35 | expect_equal(merged$oral$tiapride, leucht2016$oral$tiapride) 36 | 37 | expect_warning(add_key(gardner2010, leucht2016, trim=FALSE)) 38 | 39 | }) 40 | 41 | test_that("has_long_name() does as it says", { 42 | 43 | expect_equal(has_long_name(gardner2010), TRUE) 44 | expect_equal(has_long_name(gardner2010_withsai), TRUE) 45 | expect_equal(has_long_name(leucht2016), FALSE) 46 | 47 | }) 48 | 49 | test_that("included keys are valid format", { 50 | expect_equal(check_key(gardner2010), TRUE) 51 | expect_equal(check_key(gardner2010_withsai), TRUE) 52 | expect_equal(check_key(leucht2016), TRUE) 53 | expect_equal(check_key(davis1974), TRUE) 54 | expect_equal(check_key(woods2003), TRUE) 55 | }) 56 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | 6 | /* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ 7 | 8 | /* All levels of nav */ 9 | nav[data-toggle='toc'] .nav > li > a { 10 | display: block; 11 | padding: 4px 20px; 12 | font-size: 13px; 13 | font-weight: 500; 14 | color: #767676; 15 | } 16 | nav[data-toggle='toc'] .nav > li > a:hover, 17 | nav[data-toggle='toc'] .nav > li > a:focus { 18 | padding-left: 19px; 19 | color: #563d7c; 20 | text-decoration: none; 21 | background-color: transparent; 22 | border-left: 1px solid #563d7c; 23 | } 24 | nav[data-toggle='toc'] .nav > .active > a, 25 | nav[data-toggle='toc'] .nav > .active:hover > a, 26 | nav[data-toggle='toc'] .nav > .active:focus > a { 27 | padding-left: 18px; 28 | font-weight: bold; 29 | color: #563d7c; 30 | background-color: transparent; 31 | border-left: 2px solid #563d7c; 32 | } 33 | 34 | /* Nav: second level (shown on .active) */ 35 | nav[data-toggle='toc'] .nav .nav { 36 | display: none; /* Hide by default, but at >768px, show it */ 37 | padding-bottom: 10px; 38 | } 39 | nav[data-toggle='toc'] .nav .nav > li > a { 40 | padding-top: 1px; 41 | padding-bottom: 1px; 42 | padding-left: 30px; 43 | font-size: 12px; 44 | font-weight: normal; 45 | } 46 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 47 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 48 | padding-left: 29px; 49 | } 50 | nav[data-toggle='toc'] .nav .nav > .active > a, 51 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 52 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 53 | padding-left: 28px; 54 | font-weight: 500; 55 | } 56 | 57 | /* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ 58 | nav[data-toggle='toc'] .nav > .active > ul { 59 | display: block; 60 | } 61 | -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /man/to_cpz.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/convert.R 3 | \name{to_cpz} 4 | \alias{to_cpz} 5 | \title{Calculates chlorpromazine-equivalent doses} 6 | \usage{ 7 | to_cpz( 8 | input_data, 9 | ap_label, 10 | dose_label, 11 | route = "oral", 12 | key = chlorpromazineR::gardner2010, 13 | eq_label = "cpz_eq", 14 | factor_label = "cpz_conv_factor", 15 | route_label = NULL, 16 | q_label = NULL 17 | ) 18 | } 19 | \arguments{ 20 | \item{input_data}{data.frame with antipsychotic name and dose data} 21 | 22 | \item{ap_label}{column in x that stores antipsychotic name} 23 | 24 | \item{dose_label}{column in x that stores dose} 25 | 26 | \item{route}{options include "oral", "sai", "lai" or "mixed"} 27 | 28 | \item{key}{source of the conversion factors--defaults to Gardner et al. 2010} 29 | 30 | \item{eq_label}{the name of the column to be created, to save the 31 | calculated CPZ-equivalent dose} 32 | 33 | \item{factor_label}{the name of the column to be created to store the 34 | conversion factors} 35 | 36 | \item{route_label}{if "mixed" route is specified, provide the column that 37 | stores the route information} 38 | 39 | \item{q_label}{if long-acting injectable doses are included, provide the 40 | column that stores the injection frequency (days), or only if the doses have 41 | already been divided, set q_label = 1.} 42 | } 43 | \value{ 44 | data.frame with new variables storing conversion factor and 45 | CPZ-equivalent doses 46 | } 47 | \description{ 48 | Given a data.frame containing doses of antipsychotics to_cpz() converts the 49 | doses into the equivalent chlorpromazine (CPZ) doses, using the conversion 50 | factors specified in the key. 51 | } 52 | \details{ 53 | The default key is gardner2010 which has data for both oral and long-acting 54 | antipsychotic medications. See help(gardner2010) for the source reference. 55 | } 56 | \examples{ 57 | participant_ID <- c("P01", "P02", "P03", "P04") 58 | age <- c(42, 29, 30, 60) 59 | antipsychotic <- c("olanzapine", "olanzapine", "quetiapine", "ziprasidone") 60 | dose <- c(10, 12.5, 300, 60) 61 | example_oral <- data.frame(participant_ID, age, antipsychotic, dose, 62 | stringsAsFactors = FALSE) 63 | to_cpz(example_oral, ap_label = "antipsychotic", dose_label = "dose", 64 | route = "oral") 65 | } 66 | \seealso{ 67 | Other conversion functions: 68 | \code{\link{to_ap}()} 69 | } 70 | \concept{conversion functions} 71 | -------------------------------------------------------------------------------- /inst/extdata/leucht2016.csv: -------------------------------------------------------------------------------- 1 | route,drug,CPZ100MGEQ 2 | oral,Acepromazine,33.33 3 | oral,Acetophenazine,16.67 4 | oral,Amisulpride,133.33 5 | oral,Aripiprazole,5.00 6 | oral,Asenapine,6.67 7 | oral,Benperidol,0.50 8 | oral,Bromperidol,3.33 9 | oral,Butaperazine,3.33 10 | oral,Chlorpromazine,100.00 11 | oral,Chlorprothixene,100.00 12 | oral,Clopenthixol,33.33 13 | oral,Clotiapine,26.67 14 | oral,Clozapine,100.00 15 | oral,Dixyrazine,16.67 16 | oral,Flupentixol,2.00 17 | oral,Fluphenazine,3.33 18 | oral,Haloperidol,2.67 19 | oral,Levomepromazine,100.00 20 | oral,Levosulpiride,133.33 21 | oral,Loxapine,33.33 22 | oral,Lurasidone,20.00 23 | oral,Melperone,100.00 24 | oral,Mesoridazine,66.67 25 | oral,Molindone,16.67 26 | oral,Moperone,6.67 27 | oral,Olanzapine,3.33 28 | oral,Oxypertine,40.00 29 | oral,Paliperidone,2.00 30 | oral,Penfluridol,2.00 31 | oral,Perazine,33.33 32 | oral,Periciazine,16.67 33 | oral,Perphenazine,10.00 34 | oral,Pimozide,1.33 35 | oral,Pipamperone,66.67 36 | oral,Pipotiazine,3.33 37 | oral,Prochlorperazine,33.33 38 | oral,Promazine,100.00 39 | oral,Prothipendyl,80.00 40 | oral,Quetiapine,133.33 41 | oral,Remoxipride,100.00 42 | oral,Risperidone,1.67 43 | oral,Sertindole,5.33 44 | oral,Sulpiride,266.67 45 | oral,Sultopride,400.00 46 | oral,Thiopropazate,20.00 47 | oral,Thioproperazine,25.00 48 | oral,Thioridazine,100.00 49 | oral,Tiapride,133.33 50 | oral,Tiotixene,10.00 51 | oral,Trifluoperazine,6.67 52 | oral,trifluperidol,0.67 53 | oral,Triflupromazine,33.33 54 | oral,Ziprasidone,26.67 55 | oral,Zotepine,66.67 56 | oral,Zuclopenthixol,10.00 57 | SAI,Acepromazine,16.67 58 | SAI,Aripiprazole,5.00 59 | SAI,Bromperidol,3.33 60 | SAI,Chlorpromazine,33.33 61 | SAI,Chlorprothixene,16.67 62 | SAI,Clopenthixol,33.33 63 | SAI,Clotiapine,26.67 64 | SAI,Clozapine,100.00 65 | SAI,Dixyrazine,10.00 66 | SAI,Droperidol,0.83 67 | SAI,Haloperidol,2.67 68 | SAI,Levomepromazine,33.33 69 | SAI,Melperone,100.00 70 | SAI,Mesoridazine,66.67 71 | SAI,Moperone,6.67 72 | SAI,Olanzapine,3.33 73 | SAI,Perazine,33.33 74 | SAI,Periciazine,6.67 75 | SAI,Perphenazine,3.33 76 | SAI,Prochlorperazine,16.67 77 | SAI,Promazine,33.33 78 | SAI,Prothipendyl,80.00 79 | SAI,Remoxipride,100.00 80 | SAI,Sulpiride,266.67 81 | SAI,Thioproperazine,6.67 82 | SAI,Tiapride,133.33 83 | SAI,Trifluoperazine,2.67 84 | SAI,Triflupromazine,33.33 85 | SAI,Ziprasidone,13.33 86 | SAI,Zuclopenthixol,10.00 87 | LAI,Bromperidol,1.10 88 | LAI,Flupentixol,1.33 89 | LAI,Fluphenazine,0.33 90 | LAI,Fluspirilene,0.23 91 | LAI,Haloperidol,1.10 92 | LAI,Olanzapine,3.33 93 | LAI,Paliperidone,0.83 94 | LAI,Perphenazine,2.33 95 | LAI,Pipotiazine,1.67 96 | LAI,Risperidone,0.90 97 | LAI,Zuclopenthixol,5.00 -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # CONTRIBUTING # 2 | 3 | ### Fixing typos 4 | 5 | Small typos or grammatical errors in documentation may be edited directly using 6 | the GitHub web interface, so long as the changes are made in the _source_ file. 7 | 8 | * YES: you edit a roxygen comment in a `.R` file below `R/`. 9 | * NO: you edit an `.Rd` file below `man/`. 10 | 11 | ### Prerequisites 12 | 13 | Before you make a substantial pull request, you should always file an issue and 14 | make sure someone from the team agrees that it’s a problem. If you’ve found a 15 | bug, create an associated issue and illustrate the bug with a minimal 16 | [reprex](https://www.tidyverse.org/help/#reprex). 17 | 18 | ### Pull request process 19 | 20 | * We recommend that you create a Git branch for each pull request (PR). 21 | * Look at the Travis and AppVeyor build status before and after making changes. 22 | The `README` should contain badges for any continuous integration services used 23 | by the package. 24 | * We recommend the tidyverse [style guide](http://style.tidyverse.org). 25 | You can use the [styler](https://CRAN.R-project.org/package=styler) package to 26 | apply these styles, but please don't restyle code that has nothing to do with 27 | your PR. 28 | * We use [roxygen2](https://cran.r-project.org/package=roxygen2). 29 | * We use [testthat](https://cran.r-project.org/package=testthat). Contributions 30 | with test cases included are easier to accept. 31 | * For user-facing changes, add a bullet to the top of `NEWS.md` below the 32 | current development version header describing the changes made followed by your 33 | GitHub username, and links to relevant issue(s)/PR(s). 34 | 35 | ### Code of Conduct 36 | 37 | Please note that the chlorpromazineR project is released with a 38 | [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this 39 | project you agree to abide by its terms. 40 | 41 | ### See rOpenSci [contributing guide](https://devguide.ropensci.org/contributingguide.html) 42 | for further details. 43 | 44 | ### Discussion forum 45 | 46 | Check out our [discussion forum](https://discuss.ropensci.org) if 47 | 48 | * you have a question, an use case, or otherwise not a bug or feature request for the software itself. 49 | * you think your issue requires a longer form discussion. 50 | 51 | ### Prefer to Email? 52 | 53 | Email the person listed as maintainer in the `DESCRIPTION` file of this repo. 54 | 55 | Though note that private discussions over email don't help others - of course email is totally warranted if it's a sensitive problem of any kind. 56 | 57 | ### Thanks for contributing! 58 | 59 | This contributing guide is adapted from the tidyverse contributing guide available at https://raw.githubusercontent.com/r-lib/usethis/master/inst/templates/tidy-contributing.md 60 | -------------------------------------------------------------------------------- /man/to_ap.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/convert.R 3 | \name{to_ap} 4 | \alias{to_ap} 5 | \title{Calculates equivalent doses} 6 | \usage{ 7 | to_ap( 8 | input_data, 9 | convert_to_ap = "olanzapine", 10 | convert_to_route = "oral", 11 | ap_label, 12 | dose_label, 13 | route = "oral", 14 | key = chlorpromazineR::gardner2010, 15 | cpz_eq_label = "cpz_eq", 16 | ref_eq_label = "ap_eq", 17 | factor_label = "cpz_conv_factor", 18 | route_label = NULL, 19 | q_label = NULL 20 | ) 21 | } 22 | \arguments{ 23 | \item{input_data}{data.frame with antipsychotic name and dose data} 24 | 25 | \item{convert_to_ap}{name of desired reference antipsychotic} 26 | 27 | \item{convert_to_route}{the route of the desired reference antipsychotic} 28 | 29 | \item{ap_label}{column in x that stores antipsychotic name} 30 | 31 | \item{dose_label}{column in x that stores dose} 32 | 33 | \item{route}{options include "oral", "sai", "lai" or "mixed"} 34 | 35 | \item{key}{source of the conversion factors--defaults to Gardner et al. 2010} 36 | 37 | \item{cpz_eq_label}{the name of the column to be created, to save the 38 | calculated CPZ-equivalent dose} 39 | 40 | \item{ref_eq_label}{the name of the column to be created to save the doses in 41 | terms of the specified reference antipsychotic (in convert_to_ap)} 42 | 43 | \item{factor_label}{the name of the column to be created to store the 44 | conversion factors} 45 | 46 | \item{route_label}{if "mixed" route is specified, provide the column that 47 | stores the route information} 48 | 49 | \item{q_label}{if long-acting injectable doses are included, provide the 50 | column that stores the injection frequency (days), or only if the doses have 51 | already been divided, set q_label = 1.} 52 | } 53 | \value{ 54 | data.frame with new variables storing conversion factor and 55 | CPZ-equivalent doses 56 | } 57 | \description{ 58 | As in to_cpz(), to_ap() converts doses of antipsychotics into equivalent 59 | doses to a reference antipsychotic. Whereas in to_cpz() the reference 60 | antipsychotic is chlorpromazine (CPZ), to_ap() converts to equivalents of an 61 | arbitrary antipsychotic specified as a string to convert_to_ap. Conversion 62 | factors are specified in the key. 63 | } 64 | \examples{ 65 | participant_ID <- c("P01", "P02", "P03", "P04") 66 | age <- c(42, 29, 30, 60) # not used in calculation, just shows other data 67 | # can exist in the data.frame 68 | antipsychotic <- c("olanzapine", "olanzapine", "quetiapine", "ziprasidone") 69 | dose <- c(10, 12.5, 300, 60) 70 | example_oral <- data.frame(participant_ID, age, antipsychotic, dose, 71 | stringsAsFactors = FALSE) 72 | to_ap(example_oral, convert_to_ap="olanzapine", convert_to_route="oral", 73 | ap_label = "antipsychotic", dose_label = "dose", route = "oral") 74 | } 75 | \seealso{ 76 | Other conversion functions: 77 | \code{\link{to_cpz}()} 78 | } 79 | \concept{conversion functions} 80 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. 2 | # https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - master 8 | pull_request: 9 | branches: 10 | - main 11 | - master 12 | 13 | name: R-CMD-check 14 | 15 | jobs: 16 | R-CMD-check: 17 | runs-on: ${{ matrix.config.os }} 18 | 19 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 20 | 21 | strategy: 22 | fail-fast: false 23 | matrix: 24 | config: 25 | - {os: windows-latest, r: 'release'} 26 | - {os: macOS-latest, r: 'release'} 27 | - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} 28 | - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} 29 | 30 | env: 31 | R_REMOTES_NO_ERRORS_FROM_WARNINGS: true 32 | RSPM: ${{ matrix.config.rspm }} 33 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 34 | 35 | steps: 36 | - uses: actions/checkout@v2 37 | 38 | - uses: r-lib/actions/setup-r@v1 39 | with: 40 | r-version: ${{ matrix.config.r }} 41 | 42 | - uses: r-lib/actions/setup-pandoc@v1 43 | 44 | - name: Query dependencies 45 | run: | 46 | install.packages('remotes') 47 | saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) 48 | writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") 49 | shell: Rscript {0} 50 | 51 | - name: Restore R package cache 52 | if: runner.os != 'Windows' 53 | uses: actions/cache@v2 54 | with: 55 | path: ${{ env.R_LIBS_USER }} 56 | key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} 57 | restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- 58 | 59 | - name: Install system dependencies 60 | if: runner.os == 'Linux' 61 | run: | 62 | while read -r cmd 63 | do 64 | eval sudo $cmd 65 | done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') 66 | 67 | - name: Install dependencies 68 | run: | 69 | remotes::install_deps(dependencies = TRUE) 70 | remotes::install_cran("rcmdcheck") 71 | shell: Rscript {0} 72 | 73 | - name: Check 74 | env: 75 | _R_CHECK_CRAN_INCOMING_REMOTE_: false 76 | run: | 77 | options(crayon.enabled = TRUE) 78 | rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") 79 | shell: Rscript {0} 80 | 81 | - name: Upload check results 82 | if: failure() 83 | uses: actions/upload-artifact@main 84 | with: 85 | name: ${{ runner.os }}-r${{ matrix.config.r }}-results 86 | path: check 87 | -------------------------------------------------------------------------------- /docs/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $('.navbar-fixed-top').headroom(); 6 | 7 | $('body').css('padding-top', $('.navbar').height() + 10); 8 | $(window).resize(function(){ 9 | $('body').css('padding-top', $('.navbar').height() + 10); 10 | }); 11 | 12 | $('[data-toggle="tooltip"]').tooltip(); 13 | 14 | var cur_path = paths(location.pathname); 15 | var links = $("#navbar ul li a"); 16 | var max_length = -1; 17 | var pos = -1; 18 | for (var i = 0; i < links.length; i++) { 19 | if (links[i].getAttribute("href") === "#") 20 | continue; 21 | // Ignore external links 22 | if (links[i].host !== location.host) 23 | continue; 24 | 25 | var nav_path = paths(links[i].pathname); 26 | 27 | var length = prefix_length(nav_path, cur_path); 28 | if (length > max_length) { 29 | max_length = length; 30 | pos = i; 31 | } 32 | } 33 | 34 | // Add class to parent
  • , and enclosing
  • if in dropdown 35 | if (pos >= 0) { 36 | var menu_anchor = $(links[pos]); 37 | menu_anchor.parent().addClass("active"); 38 | menu_anchor.closest("li.dropdown").addClass("active"); 39 | } 40 | }); 41 | 42 | function paths(pathname) { 43 | var pieces = pathname.split("/"); 44 | pieces.shift(); // always starts with / 45 | 46 | var end = pieces[pieces.length - 1]; 47 | if (end === "index.html" || end === "") 48 | pieces.pop(); 49 | return(pieces); 50 | } 51 | 52 | // Returns -1 if not found 53 | function prefix_length(needle, haystack) { 54 | if (needle.length > haystack.length) 55 | return(-1); 56 | 57 | // Special case for length-0 haystack, since for loop won't run 58 | if (haystack.length === 0) { 59 | return(needle.length === 0 ? 0 : -1); 60 | } 61 | 62 | for (var i = 0; i < haystack.length; i++) { 63 | if (needle[i] != haystack[i]) 64 | return(i); 65 | } 66 | 67 | return(haystack.length); 68 | } 69 | 70 | /* Clipboard --------------------------*/ 71 | 72 | function changeTooltipMessage(element, msg) { 73 | var tooltipOriginalTitle=element.getAttribute('data-original-title'); 74 | element.setAttribute('data-original-title', msg); 75 | $(element).tooltip('show'); 76 | element.setAttribute('data-original-title', tooltipOriginalTitle); 77 | } 78 | 79 | if(ClipboardJS.isSupported()) { 80 | $(document).ready(function() { 81 | var copyButton = ""; 82 | 83 | $(".examples, div.sourceCode").addClass("hasCopyButton"); 84 | 85 | // Insert copy buttons: 86 | $(copyButton).prependTo(".hasCopyButton"); 87 | 88 | // Initialize tooltips: 89 | $('.btn-copy-ex').tooltip({container: 'body'}); 90 | 91 | // Initialize clipboard: 92 | var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { 93 | text: function(trigger) { 94 | return trigger.parentNode.textContent; 95 | } 96 | }); 97 | 98 | clipboardBtnCopies.on('success', function(e) { 99 | changeTooltipMessage(e.trigger, 'Copied!'); 100 | e.clearSelection(); 101 | }); 102 | 103 | clipboardBtnCopies.on('error', function() { 104 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 105 | }); 106 | }); 107 | } 108 | })(window.jQuery || window.$) 109 | -------------------------------------------------------------------------------- /doc/walkthrough.R: -------------------------------------------------------------------------------- 1 | ## ----setup, include = FALSE--------------------------------------------------- 2 | library(chlorpromazineR) 3 | knitr::opts_chunk$set( 4 | collapse = TRUE, 5 | comment = "#>" 6 | ) 7 | 8 | ## ----------------------------------------------------------------------------- 9 | names(gardner2010) 10 | 11 | ## ----------------------------------------------------------------------------- 12 | names(gardner2010$oral)[1:5] 13 | 14 | ## ----------------------------------------------------------------------------- 15 | gardner2010$oral$aripiprazole 16 | 17 | ## ----------------------------------------------------------------------------- 18 | participant_ID <- c("P01", "P02", "P03", "P04") 19 | age <- c(42, 29, 30, 60) 20 | antipsychotic <- c("olanzapine", "olanzapine", "quetiapine", "ziprasidone") 21 | dose <- c(10, 12.5, 300, 60) 22 | example_oral <- data.frame(participant_ID, age, antipsychotic, dose, 23 | stringsAsFactors = FALSE) 24 | 25 | example_oral 26 | 27 | ## ----------------------------------------------------------------------------- 28 | to_cpz(example_oral, ap_label = "antipsychotic", dose_label = "dose", 29 | route = "oral") 30 | 31 | ## ----------------------------------------------------------------------------- 32 | example_lai <- example_oral 33 | example_lai$participant_ID <- c("P05", "P06", "P07", "P08") 34 | example_lai$antipsychotic <- c("zuclopenthixol decanoate", 35 | "zuclopenthixol decanoate", 36 | "perphenazine enanthate", "fluspirilene") 37 | example_lai$q <- c(14, 21, 14, 14) 38 | example_lai$dose <- c(200, 200, 50, 6) 39 | 40 | example_sai <- example_oral 41 | example_sai$participant_ID <- c("P09", "P10", "P11", "P12") 42 | example_sai$antipsychotic <- c("Chlorpromazine HCl", "Loxapine HCl", 43 | "Olanzapine tartrate", "Olanzapine tartrate") 44 | example_sai$dose <- c(100, 50, 10, 5) 45 | 46 | example_oral$q <- NA 47 | example_sai$q <- NA 48 | 49 | example_oral$route <- "oral" 50 | example_lai$route <- "lai" 51 | example_sai$route <- "sai" 52 | 53 | example_mixed <- rbind(example_oral, example_sai, example_lai) 54 | 55 | example_mixed 56 | 57 | ## ----------------------------------------------------------------------------- 58 | to_cpz(example_mixed, ap_label = "antipsychotic", dose_label = "dose", 59 | route = "mixed", route_label = "route", q_label = "q", key=gardner2010_withsai) 60 | 61 | ## ----------------------------------------------------------------------------- 62 | check_ap(example_oral, ap_label = "antipsychotic", route = "oral", key=gardner2010) 63 | 64 | ## ----------------------------------------------------------------------------- 65 | example_sai <- example_sai 66 | check_ap(example_sai, ap_label = "antipsychotic", route = "sai", key=gardner2010) 67 | 68 | ## ----------------------------------------------------------------------------- 69 | example_mixed_bad <- example_mixed 70 | example_mixed_bad[1,3] <- "olanzzzzapine" 71 | example_mixed_bad[4,3] <- "Seroquel" 72 | example_mixed_bad[5,3] <- "chlorpromazineHCl" 73 | example_mixed_bad[9,3] <- "zuclo decanoate" 74 | check_ap(example_mixed_bad, ap_label = "antipsychotic", 75 | route = "mixed", route_label = "route", key=gardner2010_withsai) 76 | 77 | ## ----------------------------------------------------------------------------- 78 | names(gardner2010$lai) 79 | 80 | ## ----------------------------------------------------------------------------- 81 | trimmed_gardner <- trim_key(gardner2010) 82 | 83 | names(trimmed_gardner$lai) 84 | 85 | ## ----------------------------------------------------------------------------- 86 | to_cpz(example_oral, ap_label = "antipsychotic", dose_label = "dose", 87 | route = "oral", key = leucht2016) 88 | 89 | ## ----------------------------------------------------------------------------- 90 | gardner_leucht <- add_key(base = gardner2010, add = leucht2016, trim = TRUE) 91 | 92 | names(gardner_leucht$sai) 93 | 94 | ## ----------------------------------------------------------------------------- 95 | other_oral <- example_oral 96 | other_oral[2,3] <- "asenapine" 97 | other_oral[2,4] <- 10 98 | 99 | check_ap(other_oral, ap_label = "antipsychotic", route = "oral") 100 | 101 | ## ----------------------------------------------------------------------------- 102 | to_cpz(other_oral, ap_label = "antipsychotic", dose_label = "dose", 103 | route = "oral", key = gardner_leucht) 104 | 105 | ## ----------------------------------------------------------------------------- 106 | to_ap(other_oral, convert_to_ap = "olanzapine", convert_to_route = "oral", 107 | ap_label = "antipsychotic", dose_label = "dose", 108 | route = "oral", key = gardner_leucht) 109 | 110 | -------------------------------------------------------------------------------- /tests/testthat/test_checks.R: -------------------------------------------------------------------------------- 1 | # chlorpromazineR package 2 | # See README.md 3 | # test_checks.R 4 | 5 | context("checking functions behave") 6 | 7 | test_that("check_ap() works with all matching example", { 8 | 9 | antipsychotic <- c("Amisulpride", "Aripiprazole", "Benperidol", 10 | "Chlorpromazine", "Clopenthixol", 11 | 12 | "Chlorpromazine HCl", "Clotiapine injectable", 13 | "Fluphenazine HCl", "Haloperidol lactate", 14 | "Loxapine HCl", 15 | 16 | "Clopenthixol decanoate", "Flupenthixol decanoate", 17 | "Fluphenazine decanoate", "Fluphenazine enanthate", 18 | "Fluspirilene") 19 | 20 | dose <- c(700, 30, 5, 600, 60, 21 | 100, 40, 5, 5, 25, 22 | 300, 40, 25, 25, 6) 23 | 24 | route <- c(rep("oral", 5), rep("sai", 5), rep("lai", 5)) 25 | 26 | q <- c(14,14,14,14,7) 27 | 28 | example <- data.frame(antipsychotic, dose, q, route, 29 | stringsAsFactors = FALSE) 30 | 31 | result <- check_ap(example, gardner2010_withsai, "antipsychotic", "mixed", 32 | "route") 33 | 34 | expect_equal(0, result) 35 | 36 | }) 37 | 38 | test_that("check_ap() works with single route example, sai", { 39 | 40 | antipsychotic <- c("Chlorpromazine HCl", "Clotiapine injectable", 41 | "Fluphenazine HCl", "Haloperidol lactate", 42 | "Loxapine HCl") 43 | 44 | dose <- c(100, 40, 5, 5, 25) 45 | 46 | example <- data.frame(antipsychotic, dose, stringsAsFactors = FALSE) 47 | 48 | result <- check_ap(example, gardner2010_withsai, "antipsychotic", "sai") 49 | 50 | expect_equal(0, result) 51 | 52 | antipsychotic[2] <- "not real" 53 | example <- data.frame(antipsychotic, dose, stringsAsFactors = FALSE) 54 | result <- check_ap(example, gardner2010_withsai, "antipsychotic", "sai") 55 | expect_equal(1, result) 56 | 57 | 58 | }) 59 | 60 | test_that("check_ap() works with single route example, oral", { 61 | 62 | antipsychotic <- c("Amisulpride", "Aripiprazole", "Benperidol", 63 | "Chlorpromazine", "Clopenthixol") 64 | 65 | dose <- c(700, 30, 5, 600, 60) 66 | 67 | example <- data.frame(antipsychotic, dose, stringsAsFactors = FALSE) 68 | 69 | result <- check_ap(example, gardner2010, "antipsychotic", "oral") 70 | 71 | expect_equal(0, result) 72 | 73 | antipsychotic[2] <- "not real" 74 | example <- data.frame(antipsychotic, dose, stringsAsFactors = FALSE) 75 | result <- check_ap(example, gardner2010, "antipsychotic", "oral") 76 | expect_equal(1, result) 77 | 78 | 79 | }) 80 | 81 | test_that("check_ap() works with mismatches in each route", { 82 | 83 | antipsychotic <- c("Amisulpride", "Aripiprazole", "Benperidol", 84 | "Chlorpromazine HCl", "Clopenthixol", 85 | 86 | "Chlorpromazine HCl", "Clotiapine injectable", 87 | "Fluphenazine HCl", "Haloperidol", 88 | "Loxapine HCl", 89 | 90 | "Clopenthixol decanoate", "Flupenthixol", 91 | "Fluphenazine decanoate", "Fluphenazine enanthate", 92 | "Fluspirilene") 93 | 94 | dose <- c(700, 30, 5, 600, 60, 95 | 100, 40, 5, 5, 25, 96 | 300, 40, 25, 25, 6) 97 | 98 | route <- c(rep("oral", 5), rep("sai", 5), rep("lai", 5)) 99 | 100 | q <- c(14,14,14,14,7) 101 | 102 | example <- data.frame(antipsychotic, dose, q, route, 103 | stringsAsFactors = FALSE) 104 | 105 | result <- check_ap(example, gardner2010_withsai, "antipsychotic", "mixed", 106 | "route") 107 | 108 | expect_equal(3, result) 109 | 110 | }) 111 | 112 | test_that("included keys validate with check_key()", { 113 | 114 | expect_equal(TRUE, check_key(gardner2010)) 115 | expect_equal(TRUE, check_key(leucht2016)) 116 | 117 | }) 118 | 119 | test_that("bad keys don't validate with check_key()", { 120 | 121 | expect_equal(TRUE, check_key(gardner2010)) 122 | expect_equal(TRUE, check_key(leucht2016)) 123 | 124 | gbad <- gardner2010 125 | names(gbad) <- c("oral", "sai", "depot") 126 | expect_error(check_key(gbad)) 127 | 128 | expect_error(check_key(list(oral=1, sai=2))) 129 | 130 | expect_error(check_key(4)) 131 | expect_error(check_key(c(4,4,4))) 132 | 133 | close <- list(oral=1,sai=2,lai=3) 134 | expect_error(check_key(close)) 135 | 136 | closer <- list(oral=list(a="hi"),sai=list(a="hi"),lai=list(a="hi")) 137 | expect_error(check_key(closer)) 138 | }) 139 | 140 | test_that("trim_key() doesn't try to work on bad key", { 141 | 142 | expect_error(trim_key(3)) 143 | 144 | }) 145 | 146 | test_that("add_key() doesn't try to work on bad key", { 147 | 148 | expect_error(add_key(gardner2010, 3, trim = T)) 149 | expect_error(add_key(3, gardner2010, trim = T)) 150 | 151 | }) 152 | 153 | -------------------------------------------------------------------------------- /codemeta.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": [ 3 | "https://doi.org/10.5063/schema/codemeta-2.0", 4 | "http://schema.org" 5 | ], 6 | "@type": "SoftwareSourceCode", 7 | "identifier": "chlorpromazineR", 8 | "description": "As different antipsychotic medications have different potencies,\n the doses of different medications cannot be directly compared. Various\n strategies are used to convert doses into a common reference so that\n comparison is meaningful. Chlorpromazine (CPZ) has historically been used\n as a reference medication into which other antipsychotic doses can be\n converted, as \"chlorpromazine-equivalent doses\". Using conversion keys\n generated from widely-cited scientific papers, e.g. Gardner et. al 2010\n and Leucht et al. 2016\n , antipsychotic doses are converted\n to CPZ (or any specified antipsychotic) equivalents. The use of the package\n is described in the included vignette. Not for clinical use.", 9 | "name": "chlorpromazineR: Convert Antipsychotic Doses to Chlorpromazine Equivalents", 10 | "codeRepository": "https://github.com/ropensci/chlorpromazineR", 11 | "issueTracker": "https://github.com/ropensci/chlorpromazineR/issues", 12 | "license": "https://spdx.org/licenses/GPL-3.0", 13 | "version": "0.2.0", 14 | "programmingLanguage": { 15 | "@type": "ComputerLanguage", 16 | "name": "R", 17 | "url": "https://r-project.org" 18 | }, 19 | "runtimePlatform": "R version 4.0.3 (2020-10-10)", 20 | "author": [ 21 | { 22 | "@type": "Person", 23 | "givenName": "Eric", 24 | "familyName": "Brown", 25 | "email": "eb@ericebrown.com", 26 | "@id": "https://orcid.org/0000-0002-1575-2606" 27 | }, 28 | { 29 | "@type": "Person", 30 | "givenName": "Parita", 31 | "familyName": "Shah", 32 | "@id": "https://orcid.org/0000-0002-7302-0411" 33 | }, 34 | { 35 | "@type": "Person", 36 | "givenName": "Julia", 37 | "familyName": "Kim", 38 | "@id": "https://orcid.org/0000-0002-0379-1333" 39 | } 40 | ], 41 | "contributor": {}, 42 | "copyrightHolder": {}, 43 | "funder": {}, 44 | "maintainer": [ 45 | { 46 | "@type": "Person", 47 | "givenName": "Eric", 48 | "familyName": "Brown", 49 | "email": "eb@ericebrown.com", 50 | "@id": "https://orcid.org/0000-0002-1575-2606" 51 | } 52 | ], 53 | "softwareSuggestions": [ 54 | { 55 | "@type": "SoftwareApplication", 56 | "identifier": "knitr", 57 | "name": "knitr", 58 | "provider": { 59 | "@id": "https://cran.r-project.org", 60 | "@type": "Organization", 61 | "name": "Comprehensive R Archive Network (CRAN)", 62 | "url": "https://cran.r-project.org" 63 | }, 64 | "sameAs": "https://CRAN.R-project.org/package=knitr" 65 | }, 66 | { 67 | "@type": "SoftwareApplication", 68 | "identifier": "rmarkdown", 69 | "name": "rmarkdown", 70 | "provider": { 71 | "@id": "https://cran.r-project.org", 72 | "@type": "Organization", 73 | "name": "Comprehensive R Archive Network (CRAN)", 74 | "url": "https://cran.r-project.org" 75 | }, 76 | "sameAs": "https://CRAN.R-project.org/package=rmarkdown" 77 | }, 78 | { 79 | "@type": "SoftwareApplication", 80 | "identifier": "testthat", 81 | "name": "testthat", 82 | "provider": { 83 | "@id": "https://cran.r-project.org", 84 | "@type": "Organization", 85 | "name": "Comprehensive R Archive Network (CRAN)", 86 | "url": "https://cran.r-project.org" 87 | }, 88 | "sameAs": "https://CRAN.R-project.org/package=testthat" 89 | }, 90 | { 91 | "@type": "SoftwareApplication", 92 | "identifier": "covr", 93 | "name": "covr", 94 | "provider": { 95 | "@id": "https://cran.r-project.org", 96 | "@type": "Organization", 97 | "name": "Comprehensive R Archive Network (CRAN)", 98 | "url": "https://cran.r-project.org" 99 | }, 100 | "sameAs": "https://CRAN.R-project.org/package=covr" 101 | } 102 | ], 103 | "softwareRequirements": [ 104 | { 105 | "@type": "SoftwareApplication", 106 | "identifier": "R", 107 | "name": "R", 108 | "version": ">= 3.5" 109 | } 110 | ], 111 | "readme": "https://github.com/ropensci/chlorpromazineR/blob/master/README.md", 112 | "contIntegration": "https://codecov.io/github/ropensci/chlorpromazineR?branch=master", 113 | "keywords": [ 114 | "psychiatry", 115 | "pharmacology", 116 | "r", 117 | "antipsychotic", 118 | "schizophrenia" 119 | ], 120 | "releaseNotes": "https://github.com/ropensci/chlorpromazineR/blob/master/NEWS.md", 121 | "provider": { 122 | "@id": "https://cran.r-project.org", 123 | "@type": "Organization", 124 | "name": "Comprehensive R Archive Network (CRAN)", 125 | "url": "https://cran.r-project.org" 126 | }, 127 | "relatedLink": [ 128 | "https://docs.ropensci.org/chlorpromazineR", 129 | "https://docs.ropensci.org/chlorpromazineR/" 130 | ], 131 | "fileSize": "2447.075KB" 132 | } 133 | -------------------------------------------------------------------------------- /R/key_functions.R: -------------------------------------------------------------------------------- 1 | # chlorpromazineR package 2 | # See README.md 3 | 4 | #' Check whether a conversion key is the expected format 5 | #' 6 | #' chlorpromazineR uses conversion factors stored in a named list of 3 named 7 | #' lists. This verifies that the key is in a usable format, which can be helpful 8 | #' when creating custom keys or modifying included keys. 9 | #' 10 | #' @export 11 | #' @param key the key to check 12 | #' @return TRUE if the key is valid, otherwise a error is thrown. 13 | #' @family key functions 14 | #' @examples check_key(gardner2010) 15 | check_key <- function(key) { 16 | 17 | if (!(is.list(key))) stop("Key is not a list.") 18 | if (length(key) != 3) stop("Key is not 3 lists.") 19 | 20 | if (!all(names(key) == c("oral", "sai", "lai"))) { 21 | stop("Key list names should be oral, sai and lai") 22 | } 23 | 24 | if (!all(unlist(lapply(key, is.list)))) { 25 | stop("Each element of key should be a list") 26 | } 27 | 28 | if (!is.numeric(unlist(lapply(unlist(key), unlist)))) { 29 | stop("Each key list should have numeric data.") 30 | } 31 | 32 | return(TRUE) 33 | } 34 | 35 | #' Modify the names in a conversion key to only include the first word 36 | #' 37 | #' For parenteral (sai) and long-acting/depot (lai) antipsychotics, the name 38 | #' consists of the usual generic name (such as haloperidol) and a second word 39 | #' describing the formulation (e.g. haloperidol decanoate). Since to_cpz() and 40 | #' add_key() require exact matches to work properly, removing the second word 41 | #' may be required, but should be done with care as it can add ambiguity (e.g. 42 | #' fluphenazine enanthate and decanoate). 43 | #' 44 | #' @export 45 | #' @param key the key to trim 46 | #' @return the key that was trimmed (a named list of 3 named lists) 47 | #' @family key functions 48 | #' @examples trim_key(gardner2010) 49 | trim_key <- function(key) { 50 | 51 | message("The trim_key() function can introduce errors if used in improper 52 | circumstances. Ensure that the antipsychotic compounds in your data 53 | and in the intended keys are the same compounds. The trim function is 54 | for convenience, but would introduce errors in your data if the 55 | compounds are not equivalent.") 56 | 57 | if (!check_key(key)) stop("Input key did not validate.") 58 | 59 | names(key$oral) <- sub("([A-Za-z]+).*", "\\1", names(key$oral)) 60 | names(key$sai) <- sub("([A-Za-z]+).*", "\\1", names(key$sai)) 61 | names(key$lai) <- sub("([A-Za-z]+).*", "\\1", names(key$lai)) 62 | 63 | if (!check_key(key)) stop("Output key did not validate.") 64 | 65 | return(key) 66 | } 67 | 68 | #' Combine 2 keys with base key taking precedence 69 | #' 70 | #' Use this to combine 2 keys by using the whole "base" key, and adding any 71 | #' antipsychotics from the "added" key that are not in the "base" key. 72 | #' 73 | #' @export 74 | #' @param base the base key 75 | #' @param added the key from which other antipsychotics are found to add 76 | #' @param trim TRUE to use trim_key on both the base and added key, needed when 77 | #' one does not use the full names (e.g. leucht2016). 78 | #' @param verbose If TRUE, added antipsychotic names will be shown in a message 79 | #' @return a merged key 80 | #' @family key functions 81 | #' @examples add_key(gardner2010, leucht2016, trim = TRUE) 82 | add_key <- function(base, added, trim, verbose = TRUE) { 83 | 84 | if (!check_key(base)) stop("base key did not validate.") 85 | if (!check_key(added)) stop("added key did not validate.") 86 | 87 | if (trim) { 88 | base <- trim_key(base) 89 | added <- trim_key(added) 90 | } else { 91 | if (has_long_name(base) != has_long_name(added)) { 92 | warning(paste("\nThe 2 keys differ in use of single-word names.", 93 | "Consider checking compatability and using trim = TRUE.", 94 | "Otherwise there may be duplicates.\n")) 95 | } 96 | } 97 | 98 | merged <- base 99 | 100 | oral_add <- added$oral[!(names(added$oral) %in% names(base$oral))] 101 | sai_add <- added$sai[!(names(added$sai) %in% names(base$sai))] 102 | lai_add <- added$lai[!(names(added$lai) %in% names(base$lai))] 103 | 104 | merged$oral <- c(base$oral, oral_add) 105 | merged$sai <- c(base$sai, sai_add) 106 | merged$lai <- c(base$lai, lai_add) 107 | 108 | if (!check_key(merged)) stop("Output key did not validate.") 109 | 110 | if (verbose) { 111 | message(paste0(length(oral_add), " (ORAL) were added to the base key (", 112 | paste(names(oral_add), collapse=", "), ") \n\n", 113 | length(sai_add), " (SAI) were added to the base key (", 114 | paste(names(sai_add), collapse=", "), ") \n\n", 115 | length(lai_add), " (LAI) were added to the base key (", 116 | paste(names(lai_add), collapse=", "), ") \n\n" )) 117 | } 118 | 119 | return(merged) 120 | } 121 | 122 | 123 | # Function to check whether any of the antpsychotic names in a key have a space, 124 | # i.e. likely are 2 words and would need trimming if combined. Used in add_key() 125 | # returns TRUE if any name has a space 126 | #'@noRd 127 | has_long_name <- function(key) { 128 | 129 | oral <- any(grepl(" ", names(key$oral))) 130 | sai <- any(grepl(" ", names(key$sai))) 131 | lai <- any(grepl(" ", names(key$lai))) 132 | 133 | return(any(c(oral, sai, lai))) 134 | 135 | } 136 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | (function() { 6 | 'use strict'; 7 | 8 | window.Toc = { 9 | helpers: { 10 | // return all matching elements in the set, or their descendants 11 | findOrFilter: function($el, selector) { 12 | // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ 13 | // http://stackoverflow.com/a/12731439/358804 14 | var $descendants = $el.find(selector); 15 | return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); 16 | }, 17 | 18 | generateUniqueIdBase: function(el) { 19 | var text = $(el).text(); 20 | var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); 21 | return anchor || el.tagName.toLowerCase(); 22 | }, 23 | 24 | generateUniqueId: function(el) { 25 | var anchorBase = this.generateUniqueIdBase(el); 26 | for (var i = 0; ; i++) { 27 | var anchor = anchorBase; 28 | if (i > 0) { 29 | // add suffix 30 | anchor += '-' + i; 31 | } 32 | // check if ID already exists 33 | if (!document.getElementById(anchor)) { 34 | return anchor; 35 | } 36 | } 37 | }, 38 | 39 | generateAnchor: function(el) { 40 | if (el.id) { 41 | return el.id; 42 | } else { 43 | var anchor = this.generateUniqueId(el); 44 | el.id = anchor; 45 | return anchor; 46 | } 47 | }, 48 | 49 | createNavList: function() { 50 | return $(''); 51 | }, 52 | 53 | createChildNavList: function($parent) { 54 | var $childList = this.createNavList(); 55 | $parent.append($childList); 56 | return $childList; 57 | }, 58 | 59 | generateNavEl: function(anchor, text) { 60 | var $a = $(''); 61 | $a.attr('href', '#' + anchor); 62 | $a.text(text); 63 | var $li = $('
  • '); 64 | $li.append($a); 65 | return $li; 66 | }, 67 | 68 | generateNavItem: function(headingEl) { 69 | var anchor = this.generateAnchor(headingEl); 70 | var $heading = $(headingEl); 71 | var text = $heading.data('toc-text') || $heading.text(); 72 | return this.generateNavEl(anchor, text); 73 | }, 74 | 75 | // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). 76 | getTopLevel: function($scope) { 77 | for (var i = 1; i <= 6; i++) { 78 | var $headings = this.findOrFilter($scope, 'h' + i); 79 | if ($headings.length > 1) { 80 | return i; 81 | } 82 | } 83 | 84 | return 1; 85 | }, 86 | 87 | // returns the elements for the top level, and the next below it 88 | getHeadings: function($scope, topLevel) { 89 | var topSelector = 'h' + topLevel; 90 | 91 | var secondaryLevel = topLevel + 1; 92 | var secondarySelector = 'h' + secondaryLevel; 93 | 94 | return this.findOrFilter($scope, topSelector + ',' + secondarySelector); 95 | }, 96 | 97 | getNavLevel: function(el) { 98 | return parseInt(el.tagName.charAt(1), 10); 99 | }, 100 | 101 | populateNav: function($topContext, topLevel, $headings) { 102 | var $context = $topContext; 103 | var $prevNav; 104 | 105 | var helpers = this; 106 | $headings.each(function(i, el) { 107 | var $newNav = helpers.generateNavItem(el); 108 | var navLevel = helpers.getNavLevel(el); 109 | 110 | // determine the proper $context 111 | if (navLevel === topLevel) { 112 | // use top level 113 | $context = $topContext; 114 | } else if ($prevNav && $context === $topContext) { 115 | // create a new level of the tree and switch to it 116 | $context = helpers.createChildNavList($prevNav); 117 | } // else use the current $context 118 | 119 | $context.append($newNav); 120 | 121 | $prevNav = $newNav; 122 | }); 123 | }, 124 | 125 | parseOps: function(arg) { 126 | var opts; 127 | if (arg.jquery) { 128 | opts = { 129 | $nav: arg 130 | }; 131 | } else { 132 | opts = arg; 133 | } 134 | opts.$scope = opts.$scope || $(document.body); 135 | return opts; 136 | } 137 | }, 138 | 139 | // accepts a jQuery object, or an options object 140 | init: function(opts) { 141 | opts = this.helpers.parseOps(opts); 142 | 143 | // ensure that the data attribute is in place for styling 144 | opts.$nav.attr('data-toggle', 'toc'); 145 | 146 | var $topContext = this.helpers.createChildNavList(opts.$nav); 147 | var topLevel = this.helpers.getTopLevel(opts.$scope); 148 | var $headings = this.helpers.getHeadings(opts.$scope, topLevel); 149 | this.helpers.populateNav($topContext, topLevel, $headings); 150 | } 151 | }; 152 | 153 | $(function() { 154 | $('nav[data-toggle="toc"]').each(function(i, el) { 155 | var $nav = $(el); 156 | Toc.init($nav); 157 | }); 158 | }); 159 | })(); 160 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # chlorpromazineR: Convert antipsychotic doses to chlorpromazine equivalents 2 | 3 | [![cran checks](https://cranchecks.info/badges/summary/chlorpromazineR)](https://cran.r-project.org/web/checks/check_results_chlorpromazineR.html) [![R-CMD-check](https://github.com/ropensci/chlorpromazineR/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/chlorpromazineR/actions) [![Coverage status](https://codecov.io/gh/ropensci/chlorpromazineR/branch/master/graph/badge.svg)](https://codecov.io/github/ropensci/chlorpromazineR?branch=master) [![DOI](https://zenodo.org/badge/175675220.svg)](https://zenodo.org/badge/latestdoi/175675220) [![](https://badges.ropensci.org/307_status.svg)](https://github.com/ropensci/software-review/issues/307/) 4 | 5 | 6 | Studies investigating or controlling for the impact of antipsychotic medications often need to quantify the amount of medication to which an individual is or has been exposed. As different antipsychotics have different potencies, the task is more complicated than using each medication’s daily dosage in milligrams, for example. `chlorpromazineR` is an R package to calculate dose equivalents for common oral and injectable antipsychotic medications based on conversion factors from the published literature. We do not propose to suggest which conversion factors are appropriate to use, or how to interpret the converted data. All users should also refer to the papers from which the conversion factor data originates to determine whether the use of such data is appropriate for their study. 7 | 8 | We hope that this package is of use to scientists who do clinical research involving antipsychotic medications. Specifically, the goals of this package are: 9 | 10 | * to improve transparency and consistency in calculating chlorpromazine equivalents, 11 | * to reduce human error and improve accuracy, 12 | * and to simplify workflows for large datasets, as from chart reviews of electronic health records. 13 | 14 | For further details and usage, please see the [walkthrough vignette](https://htmlpreview.github.io/?https://github.com/ropensci/chlorpromazineR/blob/master/doc/walkthrough.html). 15 | 16 | This results from this package should be double checked for accuracy when used in production. We welcome feedback--please contact via eb@ericebrown.com or file an issue. 17 | 18 | ## Installation 19 | 20 | The CRAN release version (recommended) can be installed via the command: `install.packages("chlorpromazineR")`. 21 | 22 | The development version of this package can be installed via the command: `devtools::install_github("ropensci/chlorpromazineR")`. 23 | 24 | ## Usage 25 | 26 | Once installed, load package with `library(chlorpromazineR)`. The package's main conversion functions are documented and usage and examples can be seen with `help(to_cpz)` and `help(to_ap)`. It is strongly recommended to read the articles from which the keys are derived, and to verify that the program's output is producing results as expected. This package facilitates bulk conversion, but should be verified to ensure it produces the results as expected. 27 | 28 | ### Online calculator 29 | 30 | An online calculator using this package is available as a [shiny app](http://ap.eebc.ca/). 31 | 32 | ### Convert data to chlorpromazine equivalents 33 | 34 | participant_ID <- c("P01", "P02", "P03", "P04") 35 | age <- c(42, 29, 30, 60) # not used in calculation 36 | antipsychotic <- c("olanzapine", "olanzapine", "quetiapine", "ziprasidone") 37 | dose <- c(10, 12.5, 300, 60) 38 | example_oral <- data.frame(participant_ID, age, antipsychotic, dose, 39 | stringsAsFactors = FALSE) 40 | to_cpz(example_oral, ap_label = "antipsychotic", dose_label = "dose", 41 | route = "oral") 42 | 43 | ## Disclaimer 44 | 45 | This package is not for clinical use. The authors assume no liability. All work must be verified independently. Use at own risk. 46 | 47 | ## Licence 48 | 49 | Copyright (C) 2019-2021 Eric E. Brown. This software is licensed under the GPL-3. 50 | 51 | ## Citation 52 | 53 | If you use this package in your scientific paper, please cite this package and the original papers from which the conversion factors are derived. The references can be viewed by using the built-in help function, e.g. `help(gardner2010)`, and as listed below. In addition, a spreadsheet-based tool facilitating dose equivalence conversion has been published by Leucht et al. (2020). 54 | 55 | Davis, J. (1974). Dose equivalence of the anti-psychotic drugs. 56 | Journal of Psychiatric Research, 11, 65-69. 57 | 58 | 59 | Gardner, D. M., Murphy, A. L., O’Donnell, H., Centorrino, F., & 60 | Baldessarini, R. J. (2010). International consensus study of 61 | antipsychotic dosing. The American Journal of Psychiatry, 167(6), 62 | 686–693. 63 | 64 | Leucht, S., Samara, M., Heres, S., & Davis, J. M. (2016). Dose 65 | Equivalents for Antipsychotic Drugs: The DDD Method. Schizophrenia 66 | Bulletin, 42(suppl_1), S90–S94. 67 | 68 | Leucht, S., Crippa, A., Siafis, S., Patel, M., Orsini, N. & Davis, J. M. 69 | (2020). Dose-Response Meta-Analysis of Antipsychotic Drugs for Acute 70 | Schizophrenia. American Journal of Psychiatry. 117(4). 71 | 72 | 73 | Woods, S. (2003). Chlorpromazine Equivalent Doses for the Newer 74 | Atypical Antipsychotics. Journal of Clinical Psychiatry. 64(6). 75 | 663-667. 76 | 77 | 78 | 79 | [![ropensci_footer](https://ropensci.org/public_images/ropensci_footer.png)](https://ropensci.org) 80 | -------------------------------------------------------------------------------- /tests/testthat/test_known_values.R: -------------------------------------------------------------------------------- 1 | # chlorpromazineR package 2 | # See README.md 3 | # test_known_values.R 4 | 5 | context("Comparing result to Leucht spreadsheet") 6 | 7 | #http://www.cfdm.de/media/doc/Antipsychotic%20dose%20conversion%20calculator.xls 8 | 9 | test_that("oral dose conversion is accurate with Gardner 2010", { 10 | 11 | antipsychotic <- c("Amisulpride", "Aripiprazole", "Benperidol", 12 | "Chlorpromazine", "Clorprothixene", "Clopenthixol", 13 | "Clotiapine", "Clozapine", "Droperidol", 14 | "Flupenthixol", "Fluphenazine", 15 | "Haloperidol", "Levomepromazine", "Loxapine", 16 | "Mesoridazine","Molindone", "Olanzapine", 17 | # "Oxypertine", 18 | "Paliperidone", "Pericyazine", "Perphenazine", "Pimozide", 19 | "Prochlorperazine", "Quetiapine", "Remoxipride", 20 | "Risperidone", "Sertindole", "Sulpiride", "Thioridazine", 21 | "Thiothixene", "Trifluoperazine", "Trifluperidol", 22 | "Triflupromazine", "Ziprasidone", "Zotepine", 23 | "Zuclopenthixol") 24 | dose <- c(10) 25 | oral <- data.frame(antipsychotic, dose, stringsAsFactors = FALSE) 26 | 27 | answers <- c(0.29, 6.71, 40, 0.33, 0.4, 3.3, 2, 0.5, 20, 20, 28 | 16.67, 20, 0.5, 3.3, 0.67, 2, 10, 29 | #8.33, 30 | 22.2, 4, 6.71, 25, 2.3, 31 | 0.27, 0.94, 33.33, 10, 0.25, 0.4, 6.7, 10, 100, 2, 1.25, 0.67, 32 | 4) 33 | 34 | # excluding oxypertine as there appears to be an error in the spreadsheet 35 | # vs. the Gardner paper 36 | 37 | test <- to_ap(oral, ap_label = "antipsychotic", dose_label = "dose", 38 | route = "oral", key = gardner2010, convert_to_ap="olanzapine") 39 | 40 | expect_equal(answers, test$ap_eq, tolerance = 0.01) 41 | 42 | }) 43 | 44 | test_that("LAI dose conversion is accurate with Gardner 2010", { 45 | 46 | antipsychotic <- c("risperidone microspheres") 47 | dose <- c(50) 48 | q <- c(14) 49 | lai <- data.frame(antipsychotic, dose, q, stringsAsFactors = FALSE) 50 | 51 | answers <- 19.84 52 | 53 | test <- to_ap(lai, convert_to_route = "oral", q_label = "q", 54 | ap_label = "antipsychotic", dose_label = "dose", 55 | route = "lai", key = gardner2010, convert_to_ap="olanzapine") 56 | 57 | expect_equal(answers, test$ap_eq, tolerance = .01) 58 | 59 | }) 60 | 61 | test_that("oral dose conversion is accurate with Leucht 2020", { 62 | 63 | antipsychotic <- c("Aripiprazole", "Asenapine", "Brexpiprazole", 64 | "Cariprazine", 65 | "Haloperidol", "Iloperidone", "Lurasidone", 66 | "Olanzapine", "Paliperidone", "Quetiapine", 67 | "Risperidone", "Sertindole", "Ziprasidone") 68 | dose <- c(10) 69 | oral <- data.frame(antipsychotic, dose, stringsAsFactors = FALSE) 70 | 71 | answers <- c(13.19, 10.13, 45.1, 19.88, 23.97, 7.54, 1.03, 10, 11.36, 72 | 0.31, 24.23, 6.73, 0.81) 73 | 74 | test <- to_ap(oral, ap_label = "antipsychotic", dose_label = "dose", 75 | route = "oral", key = leucht2020, convert_to_ap="olanzapine") 76 | 77 | expect_equal(answers, test$ap_eq, tolerance = .01) 78 | 79 | answers_risp <- c(5.44, 4.18, 18.61, 8.20, 9.89, 3.11, 0.43, 80 | 4.13, 4.69, 0.13, 10.00, 2.78, 0.34) 81 | 82 | test_risp <- to_ap(oral, ap_label = "antipsychotic", dose_label = "dose", 83 | route = "oral", key = leucht2020, convert_to_ap="risperidone") 84 | 85 | expect_equal(answers_risp, test_risp$ap_eq, tolerance = .01) 86 | 87 | }) 88 | 89 | test_that("LAI dose conversion is accurate with Leucht 2020", { 90 | 91 | antipsychotic <- c("aripiprazole lauroxil", "olanzapine", "paliperidone", 92 | "risperidone") 93 | dose <- c(50) 94 | q <- c(14) 95 | 96 | # in spreadsheet, entered dose is 50/14, so 3.571429 97 | 98 | lai <- data.frame(antipsychotic, dose, q, stringsAsFactors = FALSE) 99 | 100 | answers <- c(3.28, 2.74, 5.65, 20.75) 101 | 102 | test <- to_ap(lai, convert_to_route = "oral", q_label = "q", 103 | ap_label = "antipsychotic", dose_label = "dose", 104 | route = "lai", key = leucht2020, convert_to_ap="olanzapine") 105 | 106 | expect_equal(answers, test$ap_eq, tolerance = .01) 107 | 108 | answers_risp <- c(1.35, 1.13, 2.33, 8.56) 109 | test_risp <- to_ap(lai, convert_to_route = "oral", q_label = "q", 110 | ap_label = "antipsychotic", dose_label = "dose", 111 | route = "lai", key = leucht2020, 112 | convert_to_ap="risperidone") 113 | expect_equal(answers_risp, test_risp$ap_eq, tolerance = .01) 114 | 115 | }) 116 | 117 | 118 | test_that("oral dose conversion is accurate with Davis 1974", { 119 | 120 | antipsychotic <- c("Acetophenazine", "Butaperazine", "Chlorprothixene", 121 | "Fluphenazine", "Haloperidol", "Mesoridazine", 122 | "Perphenazine", "Prochlorperazine", "Thioridazine", 123 | "Thiothixene", "Trifluoperazine", "Triflupromazine") 124 | dose <- c(10) 125 | oral <- data.frame(antipsychotic, dose, stringsAsFactors = FALSE) 126 | 127 | answers <- c(42.55, 112.36, 22.78, 833.33, 625, 18.08, 112.36, 69.93, 10.49, 128 | 192.31, 357.14, 35.21) 129 | 130 | test <- to_cpz(oral, ap_label = "antipsychotic", dose_label = "dose", 131 | route = "oral", key = davis1974) 132 | 133 | expect_equal(answers, test$cpz_eq, tolerance = 0.001) 134 | 135 | }) 136 | -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Page not found (404) • chlorpromazineR 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 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
    62 |
    63 | 120 | 121 | 122 | 123 |
    124 | 125 |
    126 |
    127 | 130 | 131 | Content not found. Please use links in the navbar. 132 | 133 |
    134 | 135 | 140 | 141 |
    142 | 143 | 144 | 145 |
    146 | 149 | 150 |
    151 |

    Site built with pkgdown 1.6.1.

    152 |
    153 | 154 |
    155 |
    156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /docs/issue_template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | NA • chlorpromazineR 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 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
    62 |
    63 | 120 | 121 | 122 | 123 |
    124 | 125 |
    126 |
    127 | 130 | 131 |
    Session Info 132 |
    133 | 
    134 |
    135 | 136 |
    137 | 138 | 143 | 144 |
    145 | 146 | 147 | 148 |
    149 | 152 | 153 |
    154 |

    Site built with pkgdown 1.6.1.

    155 |
    156 | 157 |
    158 |
    159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /docs/articles/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Articles • chlorpromazineR 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 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
    62 |
    63 | 120 | 121 | 122 | 123 |
    124 | 125 |
    126 |
    127 | 130 | 131 |
    132 |

    All vignettes

    133 |

    134 | 135 |
    136 |
    Examples produced by chlorpromazineR
    137 |
    138 |
    Using chlorpromazineR to calculate chlorpromazine-equivalent doses
    139 |
    140 |
    141 |
    142 |
    143 |
    144 | 145 | 146 |
    147 | 150 | 151 |
    152 |

    Site built with pkgdown 1.6.1.

    153 |
    154 | 155 |
    156 |
    157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /docs/authors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Authors • chlorpromazineR 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 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
    62 |
    63 | 120 | 121 | 122 | 123 |
    124 | 125 |
    126 |
    127 | 130 | 131 |
      132 |
    • 133 |

      Eric Brown. Author, maintainer. 134 |

      135 |
    • 136 |
    • 137 |

      Parita Shah. Author. 138 |

      139 |
    • 140 |
    • 141 |

      Julia Kim. Author. 142 |

      143 |
    • 144 |
    • 145 |

      Frederick Boehm. Reviewer. 146 |

      147 |
    • 148 |
    149 | 150 |
    151 | 152 |
    153 | 154 | 155 | 156 |
    157 | 160 | 161 |
    162 |

    Site built with pkgdown 1.6.1.

    163 |
    164 | 165 |
    166 |
    167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /docs/pull_request_template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | NA • chlorpromazineR 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 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
    62 |
    63 | 120 | 121 | 122 | 123 |
    124 | 125 |
    126 |
    127 | 130 | 131 | 132 |
    133 |

    134 | Description

    135 | 136 |
    137 | 144 |
    145 |

    146 | Example

    147 | 149 | 151 |
    152 | 153 | 154 |
    155 | 156 | 161 | 162 |
    163 | 164 | 165 | 166 |
    167 | 170 | 171 |
    172 |

    Site built with pkgdown 1.6.1.

    173 |
    174 | 175 |
    176 |
    177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | -------------------------------------------------------------------------------- /docs/reference/davis1974.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Chlorpromazine equivalent key from Davis 1974 data — davis1974 • chlorpromazineR 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 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
    65 |
    66 | 123 | 124 | 125 | 126 |
    127 | 128 |
    129 |
    130 | 135 | 136 |
    137 |

    A list of antipsychotics and their chlorpromazine equivalent doses, generated 138 | from the following file included with the package: 139 | system.file("extdata", "davis1974.csv", package="chlorpromazineR").

    140 |
    141 | 142 |
    davis1974
    143 | 144 | 145 |

    Format

    146 | 147 |

    A named list of 3 named lists (1 for each route) and each sub-list 148 | contains the conversion factors for each antipsychotic. The 3 top-level lists 149 | are named `oral`, `sai`, and `lai` (route), and the lists they contain have 150 | names corresponding to the antipsychotic, e.g. `olanzapine`.

    151 |

    Source

    152 | 153 |

    John Davis (1974). Dose equivalence of the anti-psychotic drugs. 154 | Journal of Psychiatric Research, 11, 65-69. 155 | <https://doi.org/10.1016/0022-3956(74)90071-5>

    156 | 157 |
    158 | 163 |
    164 | 165 | 166 |
    167 | 170 | 171 |
    172 |

    Site built with pkgdown 1.6.1.

    173 |
    174 | 175 |
    176 |
    177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | -------------------------------------------------------------------------------- /docs/reference/woods2003.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Chlorpromazine equivalent key from Woods 2003 data — woods2003 • chlorpromazineR 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 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
    65 |
    66 | 123 | 124 | 125 | 126 |
    127 | 128 |
    129 |
    130 | 135 | 136 |
    137 |

    A list of antipsychotics and their chlorpromazine equivalent doses, generated 138 | from the following file included with the package: 139 | system.file("extdata", "woods2003.csv", package="chlorpromazineR").

    140 |
    141 | 142 |
    woods2003
    143 | 144 | 145 |

    Format

    146 | 147 |

    A named list of 3 named lists (1 for each route) and each sub-list 148 | contains the conversion factors for each antipsychotic. The 3 top-level lists 149 | are named `oral`, `sai`, and `lai` (route), and the lists they contain have 150 | names corresponding to the antipsychotic, e.g. `olanzapine`.

    151 |

    Source

    152 | 153 |

    Scott Woods (2003). Chlorpromazine Equivalent Doses for the Newer 154 | Atypical Antipsychotics. Journal of Clinical Psychiatry. 64(6). 663-667. 155 | <https://doi.org/10.4088/JCP.v64n0607>

    156 | 157 |
    158 | 163 |
    164 | 165 | 166 |
    167 | 170 | 171 |
    172 |

    Site built with pkgdown 1.6.1.

    173 |
    174 | 175 |
    176 |
    177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | -------------------------------------------------------------------------------- /docs/reference/leucht2016.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Chlorpromazine equivalent key from Leucht et al. 2016 data — leucht2016 • chlorpromazineR 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 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
    65 |
    66 | 123 | 124 | 125 | 126 |
    127 | 128 |
    129 |
    130 | 135 | 136 |
    137 |

    A list of antipsychotics and their chlorpromazine equivalent doses, generated 138 | from the following file included with the package: 139 | system.file("extdata", "leucht2016.csv", package="chlorpromazineR").

    140 |
    141 | 142 |
    leucht2016
    143 | 144 | 145 |

    Format

    146 | 147 |

    A named list of 3 named lists (1 for each route) and each sub-list 148 | contains the conversion factors for each antipsychotic. The 3 top-level lists 149 | are named `oral`, `sai`, and `lai` (route), and the lists they contain have 150 | names corresponding to the antipsychotic, e.g. `olanzapine`.

    151 |

    Source

    152 | 153 |

    Leucht, S., Samara, M., Heres, S., & Davis, J. M. (2016). Dose 154 | Equivalents for Antipsychotic Drugs: The DDD Method. Schizophrenia Bulletin, 155 | 42(suppl_1), S90–S94. <https://doi.org/10.1093/schbul/sbv167>

    156 | 157 |
    158 | 163 |
    164 | 165 | 166 |
    167 | 170 | 171 |
    172 |

    Site built with pkgdown 1.6.1.

    173 |
    174 | 175 |
    176 |
    177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | -------------------------------------------------------------------------------- /docs/reference/leucht2020.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Antipsychotic equivalent key from Leucht et al. 2020 data — leucht2020 • chlorpromazineR 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 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
    65 |
    66 | 123 | 124 | 125 | 126 |
    127 | 128 |
    129 |
    130 | 135 | 136 |
    137 |

    A list of antipsychotics and their olanzapine-equivalent doses, generated 138 | from the following file included with the package: 139 | system.file("extdata", "leucht2020.csv", package="chlorpromazineR").

    140 |
    141 | 142 |
    leucht2020
    143 | 144 | 145 |

    Format

    146 | 147 |

    A named list of 3 named lists (1 for each route) and each sub-list 148 | contains the conversion factors for each antipsychotic. The 3 top-level lists 149 | are named `oral`, `sai`, and `lai` (route), and the lists they contain have 150 | names corresponding to the antipsychotic, e.g. `olanzapine`.

    151 |

    Source

    152 | 153 |

    Leucht, S., Crippa, A., Siafis, S., Patel, M., Orsini, N. & Davis, 154 | J. M. (2020). Dose-Response Meta-Analysis of Antipsychotic Drugs for Acute 155 | Schizophrenia. American Journal of Psychiatry. 117(4). 156 | <https://doi.org/10.1176/appi.ajp.2019.19010034>

    157 |

    Details

    158 | 159 |

    This reference does not include chlorpromazine, so the conversion from 160 | leucht2016 is implied (i.e. chlorpromazine = olanzapine * 30).

    161 | 162 |
    163 | 168 |
    169 | 170 | 171 |
    172 | 175 | 176 |
    177 |

    Site built with pkgdown 1.6.1.

    178 |
    179 | 180 |
    181 |
    182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | -------------------------------------------------------------------------------- /docs/news/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Changelog • chlorpromazineR 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 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
    62 |
    63 | 120 | 121 | 122 | 123 |
    124 | 125 |
    126 |
    127 | 131 | 132 |
    133 |

    134 | chlorpromazineR 0.1.2 2019-10-11 135 |

    136 |

    This is the first CRAN release of the package. The package has just passed peer-review through rOpenSci. It is published in a fully functional state.

    137 |
    138 |
    139 |

    140 | chlorpromazineR 0.1.3 Unreleased 141 |

    142 |
    143 |

    144 | Major changes

    145 |

    Added new vignette with examples from each of the keys (references).

    146 |
    147 |
    148 |

    149 | Minor changes

    150 |

    Added additional tests and code cleanup.

    151 |
    152 |
    153 |
    154 |

    155 | chlorpromazineR 0.2.0 Unreleased 156 |

    157 |
    158 |

    159 | Major changes

    160 |

    Added new key: leucht2020 (https://doi.org/10.1176/appi.ajp.2019.19010034)

    161 |
    162 |

    163 | Minor changes

    164 |

    Added additional tests to compare results to spreadsheet by Leucht et al. with similar purpose.

    165 |
    166 |
    167 |
    168 |
    169 | 170 | 175 | 176 |
    177 | 178 | 179 |
    180 | 183 | 184 |
    185 |

    Site built with pkgdown 1.6.1.

    186 |
    187 | 188 |
    189 |
    190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | -------------------------------------------------------------------------------- /docs/reference/gardner2010_withsai.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Chlorpromazine equivalent key from Gardner et al. 2010 data — gardner2010_withsai • chlorpromazineR 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 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
    65 |
    66 | 123 | 124 | 125 | 126 |
    127 | 128 |
    129 |
    130 | 135 | 136 |
    137 |

    A list of antipsychotics and their chlorpromazine equivalent doses, generated 138 | from the following file included with the package: 139 | system.file("extdata", "gardner2010.csv", package="chlorpromazineR").

    140 |
    141 | 142 |
    gardner2010_withsai
    143 | 144 | 145 |

    Format

    146 | 147 |

    A named list of 3 named lists (1 for each route) and each sub-list 148 | contains the conversion factors for each antipsychotic. The 3 top-level lists 149 | are named `oral`, `sai`, and `lai` (route), and the lists they contain have 150 | names corresponding to the antipsychotic, e.g. `olanzapine`.

    151 |

    Source

    152 | 153 |

    Gardner, D. M., Murphy, A. L., O’Donnell, H., Centorrino, F., & 154 | Baldessarini, R. J. (2010). International consensus study of antipsychotic 155 | dosing. The American Journal of #' Psychiatry, 167(6), 686–693. 156 | <https://doi.org/10.1176/appi.ajp.2009.09060802>

    157 |

    Details

    158 | 159 |

    The SAI equivalents produced by this key are equivalent to chlorpromazine SAI 160 | not oral. They could be manually converted.

    161 | 162 |
    163 | 168 |
    169 | 170 | 171 |
    172 | 175 | 176 |
    177 |

    Site built with pkgdown 1.6.1.

    178 |
    179 | 180 |
    181 |
    182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | -------------------------------------------------------------------------------- /docs/reference/check_key.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Check whether a conversion key is the expected format — check_key • chlorpromazineR 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 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
    65 |
    66 | 123 | 124 | 125 | 126 |
    127 | 128 |
    129 |
    130 | 135 | 136 |
    137 |

    chlorpromazineR uses conversion factors stored in a named list of 3 named 138 | lists. This verifies that the key is in a usable format, which can be helpful 139 | when creating custom keys or modifying included keys.

    140 |
    141 | 142 |
    check_key(key)
    143 | 144 |

    Arguments

    145 | 146 | 147 | 148 | 149 | 150 | 151 |
    key

    the key to check

    152 | 153 |

    Value

    154 | 155 |

    TRUE if the key is valid, otherwise a error is thrown.

    156 |

    See also

    157 | 158 |

    Other key functions: 159 | add_key(), 160 | trim_key()

    161 | 162 |

    Examples

    163 |
    check_key(gardner2010) 164 |
    #> [1] TRUE
    165 |
    166 | 171 |
    172 | 173 | 174 |
    175 | 178 | 179 |
    180 |

    Site built with pkgdown 1.6.1.

    181 |
    182 | 183 |
    184 |
    185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | -------------------------------------------------------------------------------- /docs/reference/gardner2010.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Chlorpromazine equivalent key from Gardner et al. 2010 data — gardner2010 • chlorpromazineR 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 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
    65 |
    66 | 123 | 124 | 125 | 126 |
    127 | 128 |
    129 |
    130 | 135 | 136 |
    137 |

    A list of antipsychotics and their chlorpromazine equivalent doses, generated 138 | from the following file included with the package: 139 | system.file("extdata", "gardner2010.csv", package="chlorpromazineR").

    140 |
    141 | 142 |
    gardner2010
    143 | 144 | 145 |

    Format

    146 | 147 |

    A named list of 3 named lists (1 for each route) and each sub-list 148 | contains the conversion factors for each antipsychotic. The 3 top-level lists 149 | are named `oral`, `sai`, and `lai` (route), and the lists they contain have 150 | names corresponding to the antipsychotic, e.g. `olanzapine`.

    151 |

    Source

    152 | 153 |

    Gardner, D. M., Murphy, A. L., O’Donnell, H., Centorrino, F., & 154 | Baldessarini, R. J. (2010). International consensus study of antipsychotic 155 | dosing. The American Journal of Psychiatry, 167(6), 686–693. 156 | <https://doi.org/10.1176/appi.ajp.2009.09060802>

    157 |

    Details

    158 | 159 |

    The SAI data is not included in this key, because the original study did not 160 | specify a conversion factor from chlorpromazine LAI to oral. The alternative 161 | key gardner2010_withsai can be used, which includes the SAI data, but the 162 | chlorpromazine equivalent doses produced are equivalent to chlorpromazine SAI 163 | not chlorpromazine oral. They could be manually converted (e.g. by 164 | multiplying the SAI doses by 3 per equivalence noted by Davis 1974 165 | <https://doi.org/10.1016/0022-3956(74)90071-5>)

    166 | 167 |
    168 | 173 |
    174 | 175 | 176 |
    177 | 180 | 181 |
    182 |

    Site built with pkgdown 1.6.1.

    183 |
    184 | 185 |
    186 |
    187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /tests/testthat/test_convert.R: -------------------------------------------------------------------------------- 1 | # chlorpromazineR package 2 | # See README.md 3 | # test_convert.R 4 | 5 | context("CPZ-equivalent conversion") 6 | 7 | test_that("to_cpz() produces accurate values with oral example", { 8 | 9 | participant_ID <- c("P01", "P02", "P03", "P04") 10 | antipsychotic <- c("olanzapine", "olanzapine", "quetiapine", "ziprasidone") 11 | dose <- c(10, 12.5, 300, 60) 12 | example_oral <- data.frame(participant_ID, antipsychotic, dose, 13 | stringsAsFactors = FALSE) 14 | 15 | answers <- c(300, 375, 240, 225) 16 | 17 | test <- to_cpz(example_oral, "antipsychotic", "dose", "oral", 18 | key = gardner2010) 19 | 20 | expect_equal(answers, test$cpz_eq) 21 | 22 | }) 23 | 24 | test_that("to_cpz() produces accurate values with mixed example", { 25 | 26 | participant_ID <- c(1:15) 27 | antipsychotic <- c("Amisulpride", "Aripiprazole", "Benperidol", 28 | "Chlorpromazine", "Clopenthixol", 29 | 30 | "Chlorpromazine HCl", "Clotiapine injectable", 31 | "Fluphenazine HCl", "Haloperidol lactate", 32 | "Loxapine HCl", 33 | 34 | "Clopenthixol decanoate", "Flupenthixol decanoate", 35 | "Fluphenazine decanoate", "Fluphenazine enanthate", 36 | "Fluspirilene") 37 | dose <- c(700, 30, 5, 600, 60, 38 | 100, 40, 5, 5, 25, 39 | 300, 40, 25, 25, 6) 40 | 41 | route <- c(rep("oral", 5), rep("sai", 5), rep("lai", 5)) 42 | 43 | q_label <- c(rep(NA, 10), 14,14,14,14,7) 44 | 45 | example <- data.frame(participant_ID, antipsychotic, dose, q_label, route, 46 | stringsAsFactors = FALSE) 47 | 48 | answers <- c(rep(600, 5), rep(100, 5), rep(600, 5)) 49 | 50 | test <- to_cpz(example, "antipsychotic", "dose", "mixed", 51 | route_label = "route", q_label ="q_label", 52 | key = gardner2010_withsai) 53 | 54 | expect_equal(answers, test$cpz_eq) 55 | 56 | # and below, errors occur with malformed data 57 | 58 | expect_error(to_cpz(example, "antipsychotic", "dose", route = "not_route", 59 | route_label = "route", q_label ="q_label", 60 | key = gardner2010_withsai)) 61 | 62 | expect_error(to_cpz(example, "antipsychotic", "dose", route = "mixed", 63 | route_label = "route", q_label = NULL, 64 | key = gardner2010_withsai)) 65 | 66 | expect_error(to_cpz(example, "antipsychotic", "dose", route = "mixed", 67 | route_label = NULL, q_label = "q_label", 68 | key = gardner2010_withsai)) 69 | 70 | q_label <- c(rep(NA, 10), 14,"notnumber",14,14,7) 71 | example <- data.frame(antipsychotic, dose, q_label, route, 72 | stringsAsFactors = FALSE) 73 | 74 | expect_error(to_cpz(example, "antipsychotic", "dose", "mixed", 75 | route_label = "route", q_label ="q_label", 76 | key = ggardner2010_withsai)) 77 | 78 | 79 | }) 80 | 81 | test_that("to_cpz() produces accurate values with mixed example with 82 | pre-adjusted depot frequencies", { 83 | 84 | participant_ID <- c(1:15) 85 | antipsychotic <- c("Amisulpride", "Aripiprazole", "Benperidol", 86 | "Chlorpromazine", "Clopenthixol", 87 | 88 | "Chlorpromazine HCl", "Clotiapine injectable", 89 | "Fluphenazine HCl", "Haloperidol lactate", 90 | "Loxapine HCl", 91 | 92 | "Clopenthixol decanoate", "Flupenthixol decanoate", 93 | "Fluphenazine decanoate", "Fluphenazine enanthate", 94 | "Fluspirilene") 95 | 96 | original_dose <- c(700, 30, 5, 600, 60, 97 | 100, 40, 5, 5, 25, 98 | 300, 40, 25, 25, 6) 99 | 100 | route <- c(rep("oral", 5), rep("sai", 5), rep("lai", 5)) 101 | 102 | q_label <- c(14,14,14,14,7) 103 | 104 | dose <- original_dose 105 | dose[11:15] <- dose[11:15]/q_label 106 | 107 | example <- data.frame(participant_ID, antipsychotic, dose, route, 108 | stringsAsFactors = FALSE) 109 | 110 | answers <- c(rep(600, 5), rep(100, 5), rep(600, 5)) 111 | 112 | test <- to_cpz(example, "antipsychotic", "dose", "mixed", 113 | route_label = "route", q_label =1, key = gardner2010_withsai) 114 | 115 | expect_equal(answers, test$cpz_eq) 116 | 117 | example_lai <- data.frame(ID = participant_ID[11:15], 118 | ap = antipsychotic[11:15], 119 | dose = original_dose[11:15], route = route[11:15], 120 | q = q_label, stringsAsFactors = FALSE) 121 | 122 | test_lai <- to_cpz(example_lai, ap_label="ap", dose_label="dose", 123 | route="lai", q_label = "q", key = gardner2010_withsai) 124 | 125 | expect_equal(answers[11:15], test_lai$cpz_eq) 126 | 127 | faster_q <- q_label / 2 128 | 129 | strong_lai <- data.frame(ID = participant_ID[11:15], 130 | ap = antipsychotic[11:15], 131 | dose = original_dose[11:15], route = route[11:15], 132 | q = faster_q, stringsAsFactors = FALSE) 133 | 134 | test_strong_lai <- to_cpz(strong_lai, ap_label="ap", dose_label="dose", 135 | route="lai", q_label = "q", key = gardner2010_withsai) 136 | 137 | expect_equal(answers[11:15] * 2, test_strong_lai$cpz_eq) 138 | 139 | example_lai2 <- data.frame(ID = c(1,2,3,4), 140 | ap = c("aripiprazole lauroxil", "paliperidone", 141 | "risperidone", "olanzapine"), 142 | dose = c(441, 25, 2, 210), 143 | route = c("lai", "lai", "lai", "lai"), 144 | q = c(28, 28, 14, 14), stringsAsFactors = FALSE) 145 | 146 | test_lai_2 <- to_cpz(example_lai2, ap_label="ap", dose_label="dose", 147 | route="lai", q_label = "q", key = leucht2020) 148 | }) 149 | 150 | test_that("to_ap() rejects invalid reference antipsychotics and works", { 151 | 152 | participant_ID <- c("P01", "P02", "P03", "P04") 153 | antipsychotic <- c("olanzapine", "olanzapine", "quetiapine", "ziprasidone") 154 | dose <- c(10, 12.5, 300, 60) 155 | example_oral <- data.frame(participant_ID, antipsychotic, dose, 156 | stringsAsFactors = FALSE) 157 | 158 | olanz_answers <- c(10, 12.5, 8, 7.5) 159 | 160 | expect_error(to_ap(example_oral, convert_to_ap = "olANZ", 161 | convert_to_route = "oral", ap_label = "antipsychotic", 162 | dose_label = "dose", route = "oral", 163 | key = chlorpromazineR::gardner2010), 164 | "convert_to antipsychotic/route is not in the key") 165 | 166 | expect_error(to_ap(example_oral, convert_to_ap = "olanzapine", 167 | convert_to_route = "nai", ap_label = "antipsychotic", 168 | dose_label = "dose", route = "oral", 169 | key = chlorpromazineR::gardner2010), 170 | "convert_to antipsychotic/route is not in the key") 171 | 172 | test_olanz <- to_ap(example_oral, convert_to_ap = "olanzapine", 173 | convert_to_route = "oral", ap_label = "antipsychotic", 174 | dose_label = "dose", route = "oral", 175 | key = chlorpromazineR::gardner2010) 176 | 177 | expect_equal(test_olanz$ap_eq, olanz_answers) 178 | }) 179 | 180 | test_that("to_ap() works with sai", { 181 | 182 | antipsychotic <- c("chlorpromazine HCl", "olanzapine tartrate", 183 | "haloperidol lactate", "perphenazine USP") 184 | dose <- c(50, 5, 2.5, 5) 185 | example_sai <- data.frame(antipsychotic, dose, stringsAsFactors = FALSE) 186 | 187 | sai_answers <- c(2.5, 2.5, 2.5, 2.5) 188 | 189 | test_sai <- to_ap(example_sai, convert_to_ap = "haloperidol lactate", 190 | convert_to_route = "sai", ap_label = "antipsychotic", 191 | dose_label = "dose", route = "sai", 192 | key = chlorpromazineR::gardner2010_withsai) 193 | 194 | expect_equal(test_sai$ap_eq, sai_answers) 195 | 196 | expect_error(to_ap(example_sai, convert_to_ap = "haloperidol lactate", 197 | ap_label = "antipsychotic", 198 | dose_label = "dose", route = "sai", 199 | key = chlorpromazineR::gardner2010_withsai), 200 | "convert_to_route must be \"sai\" as well") 201 | 202 | }) 203 | -------------------------------------------------------------------------------- /docs/pkgdown.css: -------------------------------------------------------------------------------- 1 | /* Sticky footer */ 2 | 3 | /** 4 | * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ 5 | * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css 6 | * 7 | * .Site -> body > .container 8 | * .Site-content -> body > .container .row 9 | * .footer -> footer 10 | * 11 | * Key idea seems to be to ensure that .container and __all its parents__ 12 | * have height set to 100% 13 | * 14 | */ 15 | 16 | html, body { 17 | height: 100%; 18 | } 19 | 20 | body { 21 | position: relative; 22 | } 23 | 24 | body > .container { 25 | display: flex; 26 | height: 100%; 27 | flex-direction: column; 28 | } 29 | 30 | body > .container .row { 31 | flex: 1 0 auto; 32 | } 33 | 34 | footer { 35 | margin-top: 45px; 36 | padding: 35px 0 36px; 37 | border-top: 1px solid #e5e5e5; 38 | color: #666; 39 | display: flex; 40 | flex-shrink: 0; 41 | } 42 | footer p { 43 | margin-bottom: 0; 44 | } 45 | footer div { 46 | flex: 1; 47 | } 48 | footer .pkgdown { 49 | text-align: right; 50 | } 51 | footer p { 52 | margin-bottom: 0; 53 | } 54 | 55 | img.icon { 56 | float: right; 57 | } 58 | 59 | img { 60 | max-width: 100%; 61 | } 62 | 63 | /* Fix bug in bootstrap (only seen in firefox) */ 64 | summary { 65 | display: list-item; 66 | } 67 | 68 | /* Typographic tweaking ---------------------------------*/ 69 | 70 | .contents .page-header { 71 | margin-top: calc(-60px + 1em); 72 | } 73 | 74 | dd { 75 | margin-left: 3em; 76 | } 77 | 78 | /* Section anchors ---------------------------------*/ 79 | 80 | a.anchor { 81 | margin-left: -30px; 82 | display:inline-block; 83 | width: 30px; 84 | height: 30px; 85 | visibility: hidden; 86 | 87 | background-image: url(./link.svg); 88 | background-repeat: no-repeat; 89 | background-size: 20px 20px; 90 | background-position: center center; 91 | } 92 | 93 | .hasAnchor:hover a.anchor { 94 | visibility: visible; 95 | } 96 | 97 | @media (max-width: 767px) { 98 | .hasAnchor:hover a.anchor { 99 | visibility: hidden; 100 | } 101 | } 102 | 103 | 104 | /* Fixes for fixed navbar --------------------------*/ 105 | 106 | .contents h1, .contents h2, .contents h3, .contents h4 { 107 | padding-top: 60px; 108 | margin-top: -40px; 109 | } 110 | 111 | /* Navbar submenu --------------------------*/ 112 | 113 | .dropdown-submenu { 114 | position: relative; 115 | } 116 | 117 | .dropdown-submenu>.dropdown-menu { 118 | top: 0; 119 | left: 100%; 120 | margin-top: -6px; 121 | margin-left: -1px; 122 | border-radius: 0 6px 6px 6px; 123 | } 124 | 125 | .dropdown-submenu:hover>.dropdown-menu { 126 | display: block; 127 | } 128 | 129 | .dropdown-submenu>a:after { 130 | display: block; 131 | content: " "; 132 | float: right; 133 | width: 0; 134 | height: 0; 135 | border-color: transparent; 136 | border-style: solid; 137 | border-width: 5px 0 5px 5px; 138 | border-left-color: #cccccc; 139 | margin-top: 5px; 140 | margin-right: -10px; 141 | } 142 | 143 | .dropdown-submenu:hover>a:after { 144 | border-left-color: #ffffff; 145 | } 146 | 147 | .dropdown-submenu.pull-left { 148 | float: none; 149 | } 150 | 151 | .dropdown-submenu.pull-left>.dropdown-menu { 152 | left: -100%; 153 | margin-left: 10px; 154 | border-radius: 6px 0 6px 6px; 155 | } 156 | 157 | /* Sidebar --------------------------*/ 158 | 159 | #pkgdown-sidebar { 160 | margin-top: 30px; 161 | position: -webkit-sticky; 162 | position: sticky; 163 | top: 70px; 164 | } 165 | 166 | #pkgdown-sidebar h2 { 167 | font-size: 1.5em; 168 | margin-top: 1em; 169 | } 170 | 171 | #pkgdown-sidebar h2:first-child { 172 | margin-top: 0; 173 | } 174 | 175 | #pkgdown-sidebar .list-unstyled li { 176 | margin-bottom: 0.5em; 177 | } 178 | 179 | /* bootstrap-toc tweaks ------------------------------------------------------*/ 180 | 181 | /* All levels of nav */ 182 | 183 | nav[data-toggle='toc'] .nav > li > a { 184 | padding: 4px 20px 4px 6px; 185 | font-size: 1.5rem; 186 | font-weight: 400; 187 | color: inherit; 188 | } 189 | 190 | nav[data-toggle='toc'] .nav > li > a:hover, 191 | nav[data-toggle='toc'] .nav > li > a:focus { 192 | padding-left: 5px; 193 | color: inherit; 194 | border-left: 1px solid #878787; 195 | } 196 | 197 | nav[data-toggle='toc'] .nav > .active > a, 198 | nav[data-toggle='toc'] .nav > .active:hover > a, 199 | nav[data-toggle='toc'] .nav > .active:focus > a { 200 | padding-left: 5px; 201 | font-size: 1.5rem; 202 | font-weight: 400; 203 | color: inherit; 204 | border-left: 2px solid #878787; 205 | } 206 | 207 | /* Nav: second level (shown on .active) */ 208 | 209 | nav[data-toggle='toc'] .nav .nav { 210 | display: none; /* Hide by default, but at >768px, show it */ 211 | padding-bottom: 10px; 212 | } 213 | 214 | nav[data-toggle='toc'] .nav .nav > li > a { 215 | padding-left: 16px; 216 | font-size: 1.35rem; 217 | } 218 | 219 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 220 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 221 | padding-left: 15px; 222 | } 223 | 224 | nav[data-toggle='toc'] .nav .nav > .active > a, 225 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 226 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 227 | padding-left: 15px; 228 | font-weight: 500; 229 | font-size: 1.35rem; 230 | } 231 | 232 | /* orcid ------------------------------------------------------------------- */ 233 | 234 | .orcid { 235 | font-size: 16px; 236 | color: #A6CE39; 237 | /* margins are required by official ORCID trademark and display guidelines */ 238 | margin-left:4px; 239 | margin-right:4px; 240 | vertical-align: middle; 241 | } 242 | 243 | /* Reference index & topics ----------------------------------------------- */ 244 | 245 | .ref-index th {font-weight: normal;} 246 | 247 | .ref-index td {vertical-align: top; min-width: 100px} 248 | .ref-index .icon {width: 40px;} 249 | .ref-index .alias {width: 40%;} 250 | .ref-index-icons .alias {width: calc(40% - 40px);} 251 | .ref-index .title {width: 60%;} 252 | 253 | .ref-arguments th {text-align: right; padding-right: 10px;} 254 | .ref-arguments th, .ref-arguments td {vertical-align: top; min-width: 100px} 255 | .ref-arguments .name {width: 20%;} 256 | .ref-arguments .desc {width: 80%;} 257 | 258 | /* Nice scrolling for wide elements --------------------------------------- */ 259 | 260 | table { 261 | display: block; 262 | overflow: auto; 263 | } 264 | 265 | /* Syntax highlighting ---------------------------------------------------- */ 266 | 267 | pre { 268 | word-wrap: normal; 269 | word-break: normal; 270 | border: 1px solid #eee; 271 | } 272 | 273 | pre, code { 274 | background-color: #f8f8f8; 275 | color: #333; 276 | } 277 | 278 | pre code { 279 | overflow: auto; 280 | word-wrap: normal; 281 | white-space: pre; 282 | } 283 | 284 | pre .img { 285 | margin: 5px 0; 286 | } 287 | 288 | pre .img img { 289 | background-color: #fff; 290 | display: block; 291 | height: auto; 292 | } 293 | 294 | code a, pre a { 295 | color: #375f84; 296 | } 297 | 298 | a.sourceLine:hover { 299 | text-decoration: none; 300 | } 301 | 302 | .fl {color: #1514b5;} 303 | .fu {color: #000000;} /* function */ 304 | .ch,.st {color: #036a07;} /* string */ 305 | .kw {color: #264D66;} /* keyword */ 306 | .co {color: #888888;} /* comment */ 307 | 308 | .message { color: black; font-weight: bolder;} 309 | .error { color: orange; font-weight: bolder;} 310 | .warning { color: #6A0366; font-weight: bolder;} 311 | 312 | /* Clipboard --------------------------*/ 313 | 314 | .hasCopyButton { 315 | position: relative; 316 | } 317 | 318 | .btn-copy-ex { 319 | position: absolute; 320 | right: 0; 321 | top: 0; 322 | visibility: hidden; 323 | } 324 | 325 | .hasCopyButton:hover button.btn-copy-ex { 326 | visibility: visible; 327 | } 328 | 329 | /* headroom.js ------------------------ */ 330 | 331 | .headroom { 332 | will-change: transform; 333 | transition: transform 200ms linear; 334 | } 335 | .headroom--pinned { 336 | transform: translateY(0%); 337 | } 338 | .headroom--unpinned { 339 | transform: translateY(-100%); 340 | } 341 | 342 | /* mark.js ----------------------------*/ 343 | 344 | mark { 345 | background-color: rgba(255, 255, 51, 0.5); 346 | border-bottom: 2px solid rgba(255, 153, 51, 0.3); 347 | padding: 1px; 348 | } 349 | 350 | /* vertical spacing after htmlwidgets */ 351 | .html-widget { 352 | margin-bottom: 10px; 353 | } 354 | 355 | /* fontawesome ------------------------ */ 356 | 357 | .fab { 358 | font-family: "Font Awesome 5 Brands" !important; 359 | } 360 | 361 | /* don't display links in code chunks when printing */ 362 | /* source: https://stackoverflow.com/a/10781533 */ 363 | @media print { 364 | code a:link:after, code a:visited:after { 365 | content: ""; 366 | } 367 | } 368 | -------------------------------------------------------------------------------- /R/key_data.R: -------------------------------------------------------------------------------- 1 | # key_data.R 2 | 3 | # KEYS 4 | 5 | #' Chlorpromazine equivalent key from Gardner et al. 2010 data 6 | #' 7 | #' A list of antipsychotics and their chlorpromazine equivalent doses, generated 8 | #' from the following file included with the package: 9 | #' system.file("extdata", "gardner2010.csv", package="chlorpromazineR"). 10 | #' 11 | #' The SAI data is not included in this key, because the original study did not 12 | #' specify a conversion factor from chlorpromazine LAI to oral. The alternative 13 | #' key gardner2010_withsai can be used, which includes the SAI data, but the 14 | #' chlorpromazine equivalent doses produced are equivalent to chlorpromazine SAI 15 | #' not chlorpromazine oral. They could be manually converted (e.g. by 16 | #' multiplying the SAI doses by 3 per equivalence noted by Davis 1974 17 | #' ) 18 | #' 19 | #' @format A named list of 3 named lists (1 for each route) and each sub-list 20 | #' contains the conversion factors for each antipsychotic. The 3 top-level lists 21 | #' are named `oral`, `sai`, and `lai` (route), and the lists they contain have 22 | #' names corresponding to the antipsychotic, e.g. `olanzapine`. 23 | #' @source Gardner, D. M., Murphy, A. L., O’Donnell, H., Centorrino, F., & 24 | #' Baldessarini, R. J. (2010). International consensus study of antipsychotic 25 | #' dosing. The American Journal of Psychiatry, 167(6), 686–693. 26 | #' 27 | "gardner2010" 28 | 29 | #' Chlorpromazine equivalent key from Gardner et al. 2010 data 30 | #' 31 | #' A list of antipsychotics and their chlorpromazine equivalent doses, generated 32 | #' from the following file included with the package: 33 | #' system.file("extdata", "gardner2010.csv", package="chlorpromazineR"). 34 | #' 35 | #' The SAI equivalents produced by this key are equivalent to chlorpromazine SAI 36 | #' not oral. They could be manually converted. 37 | #' 38 | #' @format A named list of 3 named lists (1 for each route) and each sub-list 39 | #' contains the conversion factors for each antipsychotic. The 3 top-level lists 40 | #' are named `oral`, `sai`, and `lai` (route), and the lists they contain have 41 | #' names corresponding to the antipsychotic, e.g. `olanzapine`. 42 | #' @source Gardner, D. M., Murphy, A. L., O’Donnell, H., Centorrino, F., & 43 | #' Baldessarini, R. J. (2010). International consensus study of antipsychotic 44 | #' dosing. The American Journal of #' Psychiatry, 167(6), 686–693. 45 | #' 46 | "gardner2010_withsai" 47 | 48 | #' Chlorpromazine equivalent key from Leucht et al. 2016 data 49 | #' 50 | #' A list of antipsychotics and their chlorpromazine equivalent doses, generated 51 | #' from the following file included with the package: 52 | #' system.file("extdata", "leucht2016.csv", package="chlorpromazineR"). 53 | #' 54 | #' @format A named list of 3 named lists (1 for each route) and each sub-list 55 | #' contains the conversion factors for each antipsychotic. The 3 top-level lists 56 | #' are named `oral`, `sai`, and `lai` (route), and the lists they contain have 57 | #' names corresponding to the antipsychotic, e.g. `olanzapine`. 58 | #' @source Leucht, S., Samara, M., Heres, S., & Davis, J. M. (2016). Dose 59 | #' Equivalents for Antipsychotic Drugs: The DDD Method. Schizophrenia Bulletin, 60 | #' 42(suppl_1), S90–S94. 61 | "leucht2016" 62 | 63 | #' Antipsychotic equivalent key from Leucht et al. 2020 data 64 | #' 65 | #' A list of antipsychotics and their olanzapine-equivalent doses, generated 66 | #' from the following file included with the package: 67 | #' system.file("extdata", "leucht2020.csv", package="chlorpromazineR"). 68 | #' 69 | #' This reference does not include chlorpromazine, so the conversion from 70 | #' leucht2016 is implied (i.e. chlorpromazine = olanzapine * 30). 71 | #' 72 | #' @format A named list of 3 named lists (1 for each route) and each sub-list 73 | #' contains the conversion factors for each antipsychotic. The 3 top-level lists 74 | #' are named `oral`, `sai`, and `lai` (route), and the lists they contain have 75 | #' names corresponding to the antipsychotic, e.g. `olanzapine`. 76 | #' @source Leucht, S., Crippa, A., Siafis, S., Patel, M., Orsini, N. & Davis, 77 | #' J. M. (2020). Dose-Response Meta-Analysis of Antipsychotic Drugs for Acute 78 | #' Schizophrenia. American Journal of Psychiatry. 117(4). 79 | #' 80 | "leucht2020" 81 | 82 | #' Chlorpromazine equivalent key from Davis 1974 data 83 | #' 84 | #' A list of antipsychotics and their chlorpromazine equivalent doses, generated 85 | #' from the following file included with the package: 86 | #' system.file("extdata", "davis1974.csv", package="chlorpromazineR"). 87 | #' 88 | #' @format A named list of 3 named lists (1 for each route) and each sub-list 89 | #' contains the conversion factors for each antipsychotic. The 3 top-level lists 90 | #' are named `oral`, `sai`, and `lai` (route), and the lists they contain have 91 | #' names corresponding to the antipsychotic, e.g. `olanzapine`. 92 | #' @source John Davis (1974). Dose equivalence of the anti-psychotic drugs. 93 | #' Journal of Psychiatric Research, 11, 65-69. 94 | #' 95 | "davis1974" 96 | 97 | #' Chlorpromazine equivalent key from Woods 2003 data 98 | #' 99 | #' A list of antipsychotics and their chlorpromazine equivalent doses, generated 100 | #' from the following file included with the package: 101 | #' system.file("extdata", "woods2003.csv", package="chlorpromazineR"). 102 | #' 103 | #' @format A named list of 3 named lists (1 for each route) and each sub-list 104 | #' contains the conversion factors for each antipsychotic. The 3 top-level lists 105 | #' are named `oral`, `sai`, and `lai` (route), and the lists they contain have 106 | #' names corresponding to the antipsychotic, e.g. `olanzapine`. 107 | #' @source Scott Woods (2003). Chlorpromazine Equivalent Doses for the Newer 108 | #' Atypical Antipsychotics. Journal of Clinical Psychiatry. 64(6). 663-667. 109 | #' 110 | "woods2003" 111 | 112 | # gardner2010gen <- function() { 113 | # g <- read.csv(system.file("extdata", "gardner2010.csv", 114 | # package="chlorpromazineR"), 115 | # stringsAsFactors = FALSE) 116 | # g_oral <- as.list(600 / g[g[,"route"]=="oral",]$median) 117 | # names(g_oral) <- tolower(g[g[,"route"]=="oral",]$drug) 118 | # g_sai <- as.list(100 / g[g[,"route"]=="SAI",]$median) 119 | # names(g_sai) <- tolower(g[g[,"route"]=="SAI",]$drug) 120 | # g_lai <- as.list((600 / ((g[g[,"route"]=="LAI",]$median) / 121 | # g[g[,"route"]=="LAI",]$days))) 122 | # names(g_lai) <- tolower(g[g[,"route"]=="LAI",]$drug) 123 | # return(list(oral=g_oral, sai=g_sai, lai=g_lai)) 124 | # } 125 | 126 | # leucht2016gen <- function() { 127 | # l <- read.csv(system.file("extdata", "leucht2016.csv", 128 | # package="chlorpromazineR"), 129 | # stringsAsFactors = FALSE) 130 | # l_oral <- as.list(100 / l[l[,"route"]=="oral",]$CPZ100MGEQ) 131 | # names(l_oral) <- tolower(l[l[,"route"]=="oral",]$drug) 132 | # l_sai <- as.list(100 / l[l[,"route"]=="SAI",]$CPZ100MGEQ) 133 | # names(l_sai) <- tolower(l[l[,"route"]=="SAI",]$drug) 134 | # l_lai <- as.list(100 / l[l[,"route"]=="LAI",]$CPZ100MGEQ) 135 | # names(l_lai) <- tolower(l[l[,"route"]=="LAI",]$drug) 136 | # return(list(oral=l_oral, sai=l_sai, lai=l_lai)) 137 | #} 138 | 139 | #davis1974gen <- function() { 140 | # d <- read.csv(system.file("extdata", "davis1974.csv", 141 | # package="chlorpromazineR"), 142 | # stringsAsFactors = FALSE) 143 | # d_oral <- as.list(100 / d$CPZ100) 144 | # names(d_oral) <- tolower(d$Antipsychotic) 145 | # d_sai <- as.list(300 / d$CPZ100) 146 | # names(d_sai) <- names(d_oral) 147 | # d_lai <- list() 148 | # return(list(oral=d_oral, sai=d_sai, lai=d_lai)) 149 | #} 150 | 151 | #woods2003gen <- function() { 152 | # w <- read.csv(system.file("extdata", "woods2003.csv", 153 | # package="chlorpromazineR"), 154 | # stringsAsFactors = FALSE) 155 | # w_oral <- as.list(100 / w$CPZ100) 156 | # names(w_oral) <- tolower(w$Antipsychotic) 157 | # w_sai <- list() 158 | # w_lai <- list() 159 | # return(list(oral=w_oral, sai=w_sai, lai=w_lai)) 160 | #} 161 | 162 | # leucht2020gen <- function() { 163 | # g <- read.csv(system.file("extdata", "leucht2020.csv", 164 | # package="chlorpromazineR"), 165 | # sep=",", header=TRUE) 166 | # 167 | # g_oral <- as.list((1 / g[g[,"route"]=="oral",]$OLZ1mgeq) * 30) 168 | # names(g_oral) <- tolower(g[g[,"route"]=="oral",]$drug) 169 | # 170 | # g_lai <- as.list((1 / ((g[g[,"route"]=="LAI",]$OLZ1mgeq))) * 30) 171 | # names(g_lai) <- tolower(g[g[,"route"]=="LAI",]$drug) 172 | # 173 | # return(list(oral=g_oral, sai=list(), lai=g_lai)) 174 | # } 175 | -------------------------------------------------------------------------------- /docs/reference/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Function reference • chlorpromazineR 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 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
    62 |
    63 | 120 | 121 | 122 | 123 |
    124 | 125 |
    126 |
    127 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 156 | 157 | 158 | 159 | 162 | 163 | 164 | 165 | 168 | 169 | 170 | 171 | 174 | 175 | 176 | 177 | 180 | 181 | 182 | 183 | 186 | 187 | 188 | 189 | 192 | 193 | 194 | 195 | 198 | 199 | 200 | 201 | 204 | 205 | 206 | 207 | 210 | 211 | 212 | 213 | 216 | 217 | 218 | 219 | 222 | 223 | 224 | 225 |
    142 |

    All functions

    143 |

    144 |
    154 |

    add_key()

    155 |

    Combine 2 keys with base key taking precedence

    160 |

    check_ap()

    161 |

    Checks whether antipsychotic names are in the key

    166 |

    check_key()

    167 |

    Check whether a conversion key is the expected format

    172 |

    davis1974

    173 |

    Chlorpromazine equivalent key from Davis 1974 data

    178 |

    gardner2010

    179 |

    Chlorpromazine equivalent key from Gardner et al. 2010 data

    184 |

    gardner2010_withsai

    185 |

    Chlorpromazine equivalent key from Gardner et al. 2010 data

    190 |

    leucht2016

    191 |

    Chlorpromazine equivalent key from Leucht et al. 2016 data

    196 |

    leucht2020

    197 |

    Antipsychotic equivalent key from Leucht et al. 2020 data

    202 |

    to_ap()

    203 |

    Calculates equivalent doses

    208 |

    to_cpz()

    209 |

    Calculates chlorpromazine-equivalent doses

    214 |

    trim_key()

    215 |

    Modify the names in a conversion key to only include the first word

    220 |

    woods2003

    221 |

    Chlorpromazine equivalent key from Woods 2003 data

    226 |
    227 | 228 | 233 |
    234 | 235 | 236 | 246 |
    247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | --------------------------------------------------------------------------------