From e1116b6b8c18c0ee7e526dd42b8679f296f71f8d Mon Sep 17 00:00:00 2001 From: Mahkameh <54315392+mahkamehsalehi@users.noreply.github.com> Date: Wed, 25 Sep 2024 14:43:55 +0300 Subject: [PATCH] Add files via upload --- docs/articles/data_summary.qmd | 112 +++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 docs/articles/data_summary.qmd diff --git a/docs/articles/data_summary.qmd b/docs/articles/data_summary.qmd new file mode 100644 index 0000000..8b8e881 --- /dev/null +++ b/docs/articles/data_summary.qmd @@ -0,0 +1,112 @@ +--- +title: Data Summary +format: + revealjs: + theme: white + font-family: "Times New Roman" + slideNumber: true + + transition: slide +--- + +## Data Source + +The data used comes from the study titled "Population-level impacts of antibiotic usage on the human gut microbiome", published in Nature Communications in 2023 by Lee et al. This large-scale study includes a total of 9,251 samples collected from various human body sites and countries, aiming to assess the impact of antibiotic usage on the human gut microbiome. + +## Sample Distribution by Body Site + +The dataset comprises samples from six major body sites, with the distribution as follows: + +```{r} +library(gt) +library(dplyr) +# Create a data frame for body site distribution +body_site_data <- data.frame( + Body_Site = c("Gut", "Oral Cavity", "Skin", "Airway", "Nasal Cavity", "Vagina"), + Number_of_Samples = c(7589, 746, 380, 118, 55, 83) +) +# Display the table with enhanced styling using gt +body_site_data %>% + gt() %>% + tab_header( + title = md("**Sample Distribution by Body Site**"), + ) %>% + cols_label( + Body_Site = "Body Site", + Number_of_Samples = "Number of Samples" + ) %>% + fmt_number( + columns = c(Number_of_Samples), + decimals = 0, + use_seps = TRUE + ) %>% + tab_style( + style = cell_text(weight = "bold"), + locations = cells_column_labels(everything()) + ) %>% + tab_options( + table.font.names = "Times New Roman", + table.font.size = px(16), # Increased font size + table.border.top.width = px(2), + table.border.bottom.width = px(2), + table_body.border.top.width = px(1), + table_body.border.bottom.width = px(1), + column_labels.border.bottom.width = px(2), + data_row.padding = px(20) # Increased padding + ) +``` + +## Sample Distribution by Country + +The study collected samples from individuals across multiple countries. + +```{r} +library(gt) +library(dplyr) +library(htmltools) # For wrapping the table in a scrollable div +# Create a data frame for country sample distribution +country_sample_data <- data.frame( + Country = c("Austria", "Canada", "China", "Denmark", "France", "Germany", "Israel", + "Italy", "Kazakhstan", "Madagascar", "Netherlands", "Sweden", "USA", + "Bangladesh", "Fiji", "United Kingdom", "Tanzania"), + Number_of_Samples = c(154, 328, 1342, 580, 157, 292, 956, 536, 172, 112, 526, + 600, 1431, 47, 312, 344, 67) +) +# Arrange the data frame by Number_of_Samples descending +country_sample_data <- country_sample_data %>% + arrange(desc(Number_of_Samples)) +# Create the table with gt +country_table <- country_sample_data %>% + gt() %>% + tab_header( + title = md("**Sample Distribution by Country**") + ) %>% + cols_label( + Country = "Country", + Number_of_Samples = "Number of Samples" + ) %>% + fmt_number( + columns = c(Number_of_Samples), + decimals = 0, + use_seps = TRUE + ) %>% + tab_style( + style = cell_text(weight = "bold"), + locations = cells_column_labels(everything()) + ) %>% + tab_options( + table.font.names = "Times New Roman", + table.font.size = px(16), + table.border.top.width = px(2), + table.border.bottom.width = px(2), + table_body.border.top.width = px(1), + table_body.border.bottom.width = px(1), + column_labels.border.bottom.width = px(2), + data_row.padding = px(20) + ) +# Render the table and wrap it in a scrollable div +div( + style = "height: 400px; overflow-y: auto;", + gt::as_raw_html(country_table) +) +```