-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 39ddbe1
Showing
202 changed files
with
413,736 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Repository for GitHub Page containing database of smoking items in five British cohort studies. Information about the items on smoking behaviour was collated for the paper [*Life Course and Cohort Changes in Smoking Behaviour*](https://osf.io/54w6q/) by Liam Wright, Harry Tattan Birch, Loren Kock, and David Bann. | ||
|
||
The website was created by Liam Wright. Please email [Liam](mailto:liam.wright@ucl.ac.uk) with any comments or questions you have. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
library(shiny) | ||
library(DT) | ||
|
||
# Define UI | ||
ui <- fluidPage( | ||
titlePanel("Smoking Behaviour in Five British Cohort Studies"), | ||
|
||
tabsetPanel( | ||
# First tab - Introduction | ||
tabPanel("Introduction", | ||
br(), | ||
includeMarkdown("introduction.md"), | ||
br(), | ||
downloadButton("downloadFile1", "Download Database as Excel file") | ||
), | ||
|
||
# Second tab - Interactive Table | ||
tabPanel("Database", | ||
br(), | ||
downloadButton("downloadFile2", "Download Database as Excel file"), | ||
br(), br(), | ||
|
||
# Interactive searchable table | ||
DTOutput("table"), | ||
# Modal to display full row content | ||
uiOutput("modal") | ||
) | ||
) | ||
) | ||
|
||
# Define Server logic | ||
server <- function(input, output, session) { | ||
|
||
# Load data from the RDS file | ||
df <- readRDS("smoking_items.Rds") | ||
|
||
# Create a modal dialog to show full row content | ||
observeEvent(input$table_rows_selected, { | ||
req(input$table_rows_selected) | ||
|
||
# Get the selected row (only one row can be selected) | ||
selected_row <- df[input$table_rows_selected[1], , drop = FALSE] | ||
|
||
# Create content for the modal dialog with line breaks | ||
modal_content <- lapply(names(selected_row), function(col) { | ||
paste0("<strong>", col, ":</strong><br>", selected_row[[col]], "<br><br>") | ||
}) | ||
|
||
showModal(modalDialog( | ||
title = "Full Item Details", | ||
HTML(paste(modal_content, collapse = "")), # Display row as a paragraph with line breaks | ||
easyClose = TRUE, | ||
footer = NULL | ||
)) | ||
}) | ||
|
||
output$table <- renderDT({ | ||
datatable(df, | ||
escape = FALSE, | ||
filter = 'top', | ||
options = list( | ||
pageLength = nrow(df), | ||
searchHighlight = TRUE, | ||
scrollX = TRUE, | ||
autoWidth = TRUE, | ||
dom = 'Bfrtip', | ||
selection = 'single' | ||
) | ||
) | ||
}) | ||
|
||
output$downloadFile1 <- downloadHandler( | ||
filename = function() { "smoking_items.xlsx" }, | ||
content = function(file) { | ||
file.copy("smoking_items.xlsx", file) | ||
} | ||
) | ||
|
||
output$downloadFile2 <- downloadHandler( | ||
filename = function() { "smoking_items.xlsx" }, | ||
content = function(file) { | ||
file.copy("smoking_items.xlsx", file) | ||
} | ||
) | ||
} | ||
|
||
# Run the Shiny app | ||
shinyApp(ui = ui, server = server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
This Shiny app provides an interactive and searchable database of survey items related to smoking behaviour in five British cohort studies. Information about the items on smoking behaviour was collated for the paper [*Life Course and Cohort Changes in Smoking Behaviour*](https://osf.io/54w6q/) by Liam Wright, Harry Tattan Birch, Loren Kock, and David Bann. | ||
|
||
The cohorts included are: | ||
|
||
1. [The National Survey of Health and Development (NSHD)](https://doi.org/10.1093/ije/dyq231), a birth cohort of individuals born in mainland Britain in a single week of March 1946. | ||
2. [The National Child Development Study (NCDS)](https://doi.org/10.1093/ije/dyi183), a birth cohort of individuals born in Britain in a single week of March 1958. | ||
3. [The 1970 British Cohort Study (BCS70)](https://doi.org/10.1093/ije/dyac148), a birth cohort of individuals born in Britain in a single week of April 1970. | ||
4. [Next Steps](https://doi.org/10.5334/ohd.16) (formerly, the Longitudinal Study of Young People in England), a cohort of English schoolchildren followed from age 13/14 and born in 1989/90. | ||
5. [The Millennium Cohort Study (MCS)](https://doi.org/10.1093/ije/dyu001), a birth cohort of individuals born in the UK in 2000/02. | ||
|
||
|
||
The database contains metadata about every item on smoking behaviour from the studies. Items cover cohort members and their partners, friends and family members (e.g., parents). The metadata included spans variable names, exact question (and answer) wording, the focal person of (and respondent to) a specific item, the 'universe' of participants who were asked an item, survey mode, and the name of the (Stata) file and the survey questionnaire file the data is stored in. | ||
|
||
Except for the NSHD, the survey data can be downloaded for free from the [UK Data Service](https://ukdataservice.ac.uk/). Data from the NSHD are instead available via application on [UCL Skylark](https://skylark.ucl.ac.uk/Skylark). In due course, we will creat a *basket* of variables on Skylark so that researchers can easily find the relevant variables. | ||
|
||
The database can be viewed on this website or alternatively downloaded as an Excel file using the button below. A narrative overview of the collection of items of smoking is provided in the Supplementary Information of the [*Life Course and Cohort Changes in Smoking Behaviour*](https://osf.io/54w6q/) paper. Given data collection in each of the cohorts is ongoing, a *live* version of this overview is also available at https://osf.io/54w6q/. | ||
|
||
Our hope is that this database will facilitate further use of the cohort studies, particularly cross-cohort examinations given the large changes in smoking that have occurred in Britain since the 1950s. Each of the five cohorts contains incredibly rich data on participants additional to their smoking behaviour. This includes linkages with genetic and administrative data. We encourage researchers to explore these data further. | ||
|
||
This website was created by Liam Wright. Please email [Liam](mailto:liam.wright@ucl.ac.uk) with any comments or questions you have. Thanks for reading. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.