diff --git a/DESCRIPTION b/DESCRIPTION index 29a1dd0..5da4ccd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: tobalcepi Type: Package Title: Risk Functions and Attributable Fractions for Tobacco and Alcohol -Version: 1.2.0 +Version: 1.2.1 Authors@R: c( person(given = "Duncan", @@ -41,7 +41,9 @@ Imports: readxl, testthat, dplyr, - data.table + data.table, + Rdpack +RdMacros: Rdpack VignetteBuilder: knitr RoxygenNote: 7.1.0 Depends: diff --git a/NAMESPACE b/NAMESPACE index 7229fef..a604a9b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -14,6 +14,7 @@ export(TobLags) export(WArisk_acute) export(subgroupRisk) import(data.table) +importFrom(Rdpack,reprompt) importFrom(data.table,":=") importFrom(data.table,setDT) importFrom(data.table,setnames) diff --git a/R/AlcBinge.R b/R/AlcBinge.R index bf00975..c30d038 100644 --- a/R/AlcBinge.R +++ b/R/AlcBinge.R @@ -3,7 +3,7 @@ #' #' Designed to work with cross-sectional survey data with a wide range of individual-level covariates. #' Uses survey data and previously estimated coefficients to describe -#' the patterns of single occassion drinking. +#' the patterns of single occasion drinking. #' #' This is based on a study by Hill-McManus 2014, #' who analysed drinking occasions using data from detailed diaries in the National Diet and Nutrition Survey 2000/2001. diff --git a/R/tob_disease_names.R b/R/tob_disease_names.R index 3b92f3d..71257be 100644 --- a/R/tob_disease_names.R +++ b/R/tob_disease_names.R @@ -1,16 +1,14 @@ #' Names of tobacco-related diseases #' -#' +#' @importFrom Rdpack reprompt #' #' @docType data #' -#' @format A data table -#' -#' @source -#' -#' -#' +#' @format A character vector containing the names of the 52 disease categories +#' of smoking related diseases \insertCite{webster2018risk;textual}{tobalcepi}. #' +#' @references +#' \insertRef{webster2018risk}{tobalcepi} #' "tob_disease_names" diff --git a/R/tobacco_relative_risks.R b/R/tobacco_relative_risks.R index e681c8d..9de451c 100644 --- a/R/tobacco_relative_risks.R +++ b/R/tobacco_relative_risks.R @@ -1,16 +1,14 @@ #' Tobacco relative risks #' -#' +#' @importFrom Rdpack reprompt #' #' @docType data #' -#' @format A data table -#' -#' @source -#' -#' -#' +#' @format A data table containing the relative risks of 52 disease categories +#' for current vs. never smokers \insertCite{webster2018risk;textual}{tobalcepi}. #' +#' @references +#' \insertRef{webster2018risk}{tobalcepi} #' "tobacco_relative_risks" diff --git a/README.Rmd b/README.Rmd index 34f68e4..bf2baeb 100644 --- a/README.Rmd +++ b/README.Rmd @@ -1,6 +1,6 @@ --- output: github_document -bibliography: disease-risks.bib +bibliography: inst/REFERENCES.bib link-citations: yes citation_package: natbib biblio-style: vancouver @@ -29,7 +29,7 @@ The motivation for `tobalcepi` was to organise how we store, process and use the `tobalcepi` was created as part of a programme of work on the health economics of tobacco and alcohol at the School of Health and Related Research (ScHARR), The University of Sheffield. This programme is based around the development of the Sheffield Tobacco and Alcohol Policy Modelling (STAPM), which aims to use comparable methodologies to evaluate the impacts of tobacco and alcohol policies, and investigate the consequences of clustering and interactions between tobacco and alcohol consumption behaviours. ## Relative risk data -The disease lists and risk functions in this package all have published sources, which we have referenced. We store the master files for our tobacco and alcohol disease lists and risk functions sources in the University of Sheffield folder `X:/ScHARR/PR_Disease_Risk_TA/Disease_Lists`. In order to obtain mathematical descriptions of the risk functions for use in modelling, we needed to contact some authors to ask for additional information. +The disease lists and risk functions in this package all have published sources, which we have referenced. We store the master files for our tobacco and alcohol disease lists and risk functions sources in the University of Sheffield folder `X:/ScHARR/PR_Disease_Risk_TA/Code/tables`. In order to obtain mathematical descriptions of the risk functions for use in modelling, we needed to contact some authors to ask for additional information. ### Alcohol The high-level function for alcohol is `tobalcepi::RRalc()`, which calculates individual risks of diseases as follows: diff --git a/README.md b/README.md index 376b6e7..be8992d 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The disease lists and risk functions in this package all have published sources, which we have referenced. We store the master files for our tobacco and alcohol disease lists and risk functions sources in the University of Sheffield folder -`X:/ScHARR/PR_Disease_Risk_TA/Disease_Lists`. In order to obtain +`X:/ScHARR/PR_Disease_Risk_TA/Code/tables`. In order to obtain mathematical descriptions of the risk functions for use in modelling, we needed to contact some authors to ask for additional information. diff --git a/data-raw/disease_names.R b/data-raw/disease_names.R index 7340281..8be0db6 100644 --- a/data-raw/disease_names.R +++ b/data-raw/disease_names.R @@ -9,12 +9,7 @@ library(readxl) # Set the file path to point to the University of Sheffield X drive root_dir <- "/Volumes/" -# Load the master spreadsheet containing disease risks -TobList <- readxl::read_excel(paste0(root_dir, "ScHARR/PR_Disease_Risk_TA/Code/tables/16102018tobaccoandalcoholDiseaseListandRiskFunctions.xlsx"), sheet = "Tobacco") -tob_disease_names <- as.character(c(unique(TobList$condition))) - -usethis::use_data(tob_disease_names, overwrite = T) diff --git a/data-raw/tobacco_relative_risks.R b/data-raw/tobacco_relative_risks.R index 99135e6..1b42154 100644 --- a/data-raw/tobacco_relative_risks.R +++ b/data-raw/tobacco_relative_risks.R @@ -1,6 +1,9 @@ # This code reads and processes the relative risks for tobacco -# They are stored in X:/ScHARR/PR_Disease_Risk_TA/Code/tables +# for current vs. never smokers + +# They are stored in a master spreadsheet in X:/ScHARR/PR_Disease_Risk_TA/Code/tables +# `16102018 tobacco and alcohol Disease List and Risk Functions.xlsx` # This code reads that file and cleans it to prepare the data to be used in the model @@ -10,7 +13,9 @@ library(readxl) root_dir <- "/Volumes/" # Load the master spreadsheet containing disease risks -tobacco_relative_risks <- readxl::read_excel(paste0(root_dir, "ScHARR/PR_Disease_Risk_TA/Code/tables/16102018tobaccoandalcoholDiseaseListandRiskFunctions.xlsx"), sheet = "Tobacco") +tobacco_relative_risks <- readxl::read_excel(paste0(root_dir, + "ScHARR/PR_Disease_Risk_TA/Code/tables/16102018tobaccoandalcoholDiseaseListandRiskFunctions.xlsx"), + sheet = "Tobacco") # Set it as a data table data.table::setDT(tobacco_relative_risks) @@ -25,3 +30,8 @@ data.table::setnames(tobacco_relative_risks, "Current", "relative_risk") # Save the result to the package data folder usethis::use_data(tobacco_relative_risks, overwrite = T) +# Save a separate list of the disease names +tob_disease_names <- as.character(c(unique(tobacco_relative_risks$condition))) + +usethis::use_data(tob_disease_names, overwrite = T) + diff --git a/data/tob_disease_names.rda b/data/tob_disease_names.rda index 4d3f45c..7b00552 100644 Binary files a/data/tob_disease_names.rda and b/data/tob_disease_names.rda differ diff --git a/data/tobacco_relative_risks.rda b/data/tobacco_relative_risks.rda index ed9754b..956d548 100644 Binary files a/data/tobacco_relative_risks.rda and b/data/tobacco_relative_risks.rda differ diff --git a/disease-risks.bib b/inst/REFERENCES.bib similarity index 100% rename from disease-risks.bib rename to inst/REFERENCES.bib diff --git a/man/AlcBinge.Rd b/man/AlcBinge.Rd index bbe51b3..874cf11 100644 --- a/man/AlcBinge.Rd +++ b/man/AlcBinge.Rd @@ -18,7 +18,7 @@ Returns data plus the estimated variables. \description{ Designed to work with cross-sectional survey data with a wide range of individual-level covariates. Uses survey data and previously estimated coefficients to describe -the patterns of single occassion drinking. +the patterns of single occasion drinking. } \details{ This is based on a study by Hill-McManus 2014, diff --git a/man/tob_disease_names.Rd b/man/tob_disease_names.Rd index bececf0..803ad17 100644 --- a/man/tob_disease_names.Rd +++ b/man/tob_disease_names.Rd @@ -5,10 +5,8 @@ \alias{tob_disease_names} \title{Names of tobacco-related diseases} \format{ -A data table -} -\source{ - +A character vector containing the names of the 52 disease categories +of smoking related diseases \insertCite{webster2018risk;textual}{tobalcepi}. } \usage{ tob_disease_names @@ -16,4 +14,7 @@ tob_disease_names \description{ Names of tobacco-related diseases } +\references{ +\insertRef{webster2018risk}{tobalcepi} +} \keyword{datasets} diff --git a/man/tobacco_relative_risks.Rd b/man/tobacco_relative_risks.Rd index f55b47b..02bb75e 100644 --- a/man/tobacco_relative_risks.Rd +++ b/man/tobacco_relative_risks.Rd @@ -5,10 +5,8 @@ \alias{tobacco_relative_risks} \title{Tobacco relative risks} \format{ -A data table -} -\source{ - +A data table containing the relative risks of 52 disease categories +for current vs. never smokers \insertCite{webster2018risk;textual}{tobalcepi}. } \usage{ tobacco_relative_risks @@ -16,4 +14,7 @@ tobacco_relative_risks \description{ Tobacco relative risks } +\references{ +\insertRef{webster2018risk}{tobalcepi} +} \keyword{datasets} diff --git a/public/404.html b/public/404.html index ee96e0a..daf4645 100644 --- a/public/404.html +++ b/public/404.html @@ -71,7 +71,7 @@
diff --git a/public/LICENSE.html b/public/LICENSE.html index b51bff3..f35709e 100644 --- a/public/LICENSE.html +++ b/public/LICENSE.html @@ -71,7 +71,7 @@ diff --git a/public/articles/alc_partially_attrib_acute.html b/public/articles/alc_partially_attrib_acute.html index 4e9e747..a7dae1c 100644 --- a/public/articles/alc_partially_attrib_acute.html +++ b/public/articles/alc_partially_attrib_acute.html @@ -31,7 +31,7 @@ diff --git a/public/articles/alc_wholly_attrib_acute.html b/public/articles/alc_wholly_attrib_acute.html index 0193147..a4177b3 100644 --- a/public/articles/alc_wholly_attrib_acute.html +++ b/public/articles/alc_wholly_attrib_acute.html @@ -31,7 +31,7 @@ diff --git a/public/articles/alc_wholly_attrib_chronic.html b/public/articles/alc_wholly_attrib_chronic.html index 0f20551..62deb58 100644 --- a/public/articles/alc_wholly_attrib_chronic.html +++ b/public/articles/alc_wholly_attrib_chronic.html @@ -31,7 +31,7 @@ diff --git a/public/articles/index.html b/public/articles/index.html index 1072844..d0a5c88 100644 --- a/public/articles/index.html +++ b/public/articles/index.html @@ -71,7 +71,7 @@ diff --git a/public/articles/smoking-disease-risks.html b/public/articles/smoking-disease-risks.html index ca882b4..e285c09 100644 --- a/public/articles/smoking-disease-risks.html +++ b/public/articles/smoking-disease-risks.html @@ -31,7 +31,7 @@ diff --git a/public/authors.html b/public/authors.html index 6e653fa..67f7011 100644 --- a/public/authors.html +++ b/public/authors.html @@ -71,7 +71,7 @@ diff --git a/public/index.html b/public/index.html index 3dbf620..38a8454 100644 --- a/public/index.html +++ b/public/index.html @@ -31,7 +31,7 @@ @@ -95,7 +95,7 @@The disease lists and risk functions in this package all have published sources, which we have referenced. We store the master files for our tobacco and alcohol disease lists and risk functions sources in the University of Sheffield folder X:/ScHARR/PR_Disease_Risk_TA/Disease_Lists
. In order to obtain mathematical descriptions of the risk functions for use in modelling, we needed to contact some authors to ask for additional information.
The disease lists and risk functions in this package all have published sources, which we have referenced. We store the master files for our tobacco and alcohol disease lists and risk functions sources in the University of Sheffield folder X:/ScHARR/PR_Disease_Risk_TA/Code/tables
. In order to obtain mathematical descriptions of the risk functions for use in modelling, we needed to contact some authors to ask for additional information.
Designed to work with cross-sectional survey data with a wide range of individual-level covariates. Uses survey data and previously estimated coefficients to describe -the patterns of single occassion drinking.
+the patterns of single occasion drinking.AlcBinge(data, params = tobalcepi::binge_params)diff --git a/public/reference/AlcBinge_stapm.html b/public/reference/AlcBinge_stapm.html index 3a249b0..81c0376 100644 --- a/public/reference/AlcBinge_stapm.html +++ b/public/reference/AlcBinge_stapm.html @@ -75,7 +75,7 @@
A data table
-A character vector containing the names of the 52 disease categories +of smoking related diseases Webster et al. (2018) +.
+Webster L, Angus C, Brennan A, Gillespie D (2018). +“Smoking and the risks of adult diseases.” +doi: 10.15131/shef.data.7411451.v1 +, https://figshare.shef.ac.uk/articles/Smoking_and_the_risks_of_adult_diseases/7411451/1.
diff --git a/public/reference/tobacco_relative_risks.html b/public/reference/tobacco_relative_risks.html index d8bf5aa..07b6d96 100644 --- a/public/reference/tobacco_relative_risks.html +++ b/public/reference/tobacco_relative_risks.html @@ -72,7 +72,7 @@ @@ -138,12 +138,15 @@A data table
-A data table containing the relative risks of 52 disease categories +for current vs. never smokers Webster et al. (2018) +.
+Webster L, Angus C, Brennan A, Gillespie D (2018). +“Smoking and the risks of adult diseases.” +doi: 10.15131/shef.data.7411451.v1 +, https://figshare.shef.ac.uk/articles/Smoking_and_the_risks_of_adult_diseases/7411451/1.