library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✔ ggplot2 3.3.5      ✔ purrr   0.3.4 
## ✔ tibble  3.1.6      ✔ dplyr   1.0.10
## ✔ tidyr   1.1.4      ✔ stringr 1.4.0 
## ✔ readr   2.1.1      ✔ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(readxl)

1. Menarche Trend

trend_year_1 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/int_221107.xlsx", sheet = "dt_menarche_year")
## New names:
## • `` -> `...6`
## • `` -> `...7`
ggplot(trend_year_1) +
  aes(x = year) +
  geom_line(aes(y = Int), size = 1, color = "Black") +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H), color = "#CC0000", alpha = 0.04, lty = "dotted") +
  theme_bw() +
  labs(x = "Year"
       , y = "Menarche age") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (16)),
        axis.text = element_text(family = "Times New Roman", size = (16))) +
    scale_x_continuous(breaks = seq(2006, 2015, by=1))

2. Antisocial Behaviors across year

trend_year_2 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/int_221107.xlsx", sheet = "dt_currentdrinking_year")
## New names:
## • `` -> `...6`
## • `` -> `...7`
trend_year_3 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/int_221107.xlsx", sheet = "dt_bingetotal_year")
## New names:
## • `` -> `...6`
## • `` -> `...7`
trend_year_4 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/int_221107.xlsx", sheet = "dt_bingecurrent_year")
## New names:
## • `` -> `...6`
## • `` -> `...7`
trend_year_5 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/int_221107.xlsx", sheet = "dt_riskbeh_year")
## New names:
## • `` -> `...6`
## • `` -> `...7`
trend_year_6 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/int_221107.xlsx", sheet = "dt_smoketotal_year")
## New names:
## • `` -> `...6`
## • `` -> `...7`
trend_year_7 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/int_221107.xlsx", sheet = "dt_smokecurrent_year")
## New names:
## • `` -> `...6`
## • `` -> `...7`
t_color <- c("current drinking" = "#1B9E77",
             "binge drinking" = "#D95F02",
             "smoking (ever)" = "#E7298A",
             "current smoking (30 days)" = "#66A61E")
t_line  <- c("current drinking" = 1,
             "binge drinking" = 2,
             "smoking (ever)" = 4,
             "current smoking (30 days)" = 5)
ggplot(trend_year_2, aes(x = year)) +
  geom_line(aes(y = Int, color = "current drinking", lty = "current drinking"), size = 1) +
  geom_line(aes(y = trend_year_3$Int, color = "binge drinking", lty = "binge drinking"), size = 1) +
  geom_line(aes(y = trend_year_6$Int, color = "smoking (ever)", lty = "smoking (ever)"), size = 1) +
  geom_line(aes(y = trend_year_7$Int, color = "current smoking (30 days)", lty = "current smoking (30 days)"), size = 1) +
  theme_bw() +
  scale_color_manual(values = t_color) +
  scale_linetype_manual(values = t_line)+  
    labs(x = "Year", 
       y = "Prevalence",
       color = "", 
       lty = "") +
  theme(legend.position = "right",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (13)),
        legend.text = element_text(family = "Times New Roman", size = (13)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (11))) + 
  scale_y_continuous(breaks = seq(0, 0.3, by=0.05)) +
  scale_x_continuous(breaks = seq(2006, 2015), guide = guide_axis(angle = 90)) +
  ylim(0, 0.3)
## Scale for 'y' is already present. Adding another scale for 'y', which will
## replace the existing scale.

3. Antisocial Behaviors across age

trend_age_2 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/int_221107.xlsx", sheet = "dt_currentdrinking_age")
## New names:
## • `` -> `...6`
## • `` -> `...7`
trend_age_3 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/int_221107.xlsx", sheet = "dt_bingetotal_age")
## New names:
## • `` -> `...6`
## • `` -> `...7`
trend_age_4 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/int_221107.xlsx", sheet = "dt_bingecurrent_age")
## New names:
## • `` -> `...6`
## • `` -> `...7`
trend_age_5 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/int_221107.xlsx", sheet = "dt_riskbeh_age")
## New names:
## • `` -> `...6`
## • `` -> `...7`
trend_age_6 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/int_221107.xlsx", sheet = "dt_smoketotal_age")
## New names:
## • `` -> `...6`
## • `` -> `...7`
trend_age_7 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/int_221107.xlsx", sheet = "dt_smokecurrent_age")
## New names:
## • `` -> `...6`
## • `` -> `...7`
## • `` -> `...12`
## • `` -> `...13`
## • `` -> `...14`
## • `` -> `...15`
## • `` -> `...16`
## • `` -> `...17`
## • `` -> `...18`
t_color <- c("current drinking" = "#1B9E77",
             "binge drinking" = "#D95F02",
             "smoking (ever)" = "#E7298A",
             "current smoking (30 days)" = "#66A61E")
t_line  <- c("current drinking" = 1,
             "binge drinking" = 2,
             "smoking (ever)" = 4,
             "current smoking (30 days)" = 5)
ggplot(trend_age_2, aes(x = age)) +
  geom_line(aes(y = Int, color = "current drinking", lty = "current drinking"), size = 1) +
  geom_line(aes(y = trend_age_3$Int, color = "binge drinking", lty = "binge drinking"), size = 1) +
  geom_line(aes(y = trend_age_6$Int, color = "smoking (ever)", lty = "smoking (ever)"), size = 1) +
  geom_line(aes(y = trend_age_7$Int, color = "current smoking (30 days)", lty = "current smoking (30 days)"), size = 1) +
  theme_bw() +
  scale_color_manual(values = t_color) +
  scale_linetype_manual(values = t_line)+  
    labs(x = "Age", 
       y = "Prevalence",
       color = "", 
       lty = "") +
  theme(legend.position = "right",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (13)),
        legend.text = element_text(family = "Times New Roman", size = (13)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (11))) + 
  scale_x_continuous(breaks = seq(12, 18)) +
  scale_y_continuous(breaks = seq(0, 0.3, by=0.05)) +
  ylim(0, 0.3)
## Scale for 'y' is already present. Adding another scale for 'y', which will
## replace the existing scale.

4. Effect of Maturity Gap across Year

mgap_year_1 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "cd_by_birthyear")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_year_1) +
  aes(x = year) +
  geom_line(aes(y = Int), size = 1, color = "Black") +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H), color = "#CC0000", alpha = 0.04, lty = "dotted") +
  theme_bw() +
  labs(x = "Year"
       , y = "Current Drinking") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(1995, 2015, by=1)) +
  ylim(0.9, 1.2)

mgap_year_2 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "bd_t_by_birthyear")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_year_2) +
  aes(x = year) +
  geom_line(aes(y = Int), size = 1, color = "Black") +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H), color = "#CC0000", alpha = 0.04, lty = "dotted") +
  theme_bw() +
  labs(x = "Year"
       , y = "Binge Drinking") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(1995, 2015, by=1))+
  ylim(0.9, 1.2)

mgap_year_3 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "bd_c_by_birthyear")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_year_3) +
  aes(x = year) +
  geom_line(aes(y = Int), size = 1, color = "Black") +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H), color = "#CC0000", alpha = 0.04, lty = "dotted") +
  theme_bw() +
  labs(x = "Year"
       , y = "Binge Drinking (Current)") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(1995, 2015, by=1))+
  ylim(0.9, 1.2)

mgap_year_4 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "riskbeh_by_birthyear")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_year_4) +
  aes(x = year) +
  geom_line(aes(y = Int), size = 1, color = "Black") +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H), color = "#CC0000", alpha = 0.04, lty = "dotted") +
  theme_bw() +
  labs(x = "Year"
       , y = "Risky Behaviors after Drinking") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(1995, 2015, by=1))+
  ylim(0.9, 1.2)

mgap_year_5 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sm_t_by_birthyear")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_year_5) +
  aes(x = year) +
  geom_line(aes(y = Int), size = 1, color = "Black") +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H), color = "#CC0000", alpha = 0.04, lty = "dotted") +
  theme_bw() +
  labs(x = "Year"
       , y = "Smoking (ever)") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(1995, 2015, by=1))+
  ylim(0.9, 1.2)

mgap_year_6 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sm_c_by_birthyear")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_year_6) +
  aes(x = year) +
  geom_line(aes(y = Int), size = 1, color = "Black") +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H), color = "#CC0000", alpha = 0.04, lty = "dotted") +
  theme_bw() +
  labs(x = "Year"
       , y = "Smoking (in 30 days)") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(1995, 2015, by=1))+
  ylim(0.9, 1.21)

mgap_year_7 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sex_by_birthyear")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_year_7) +
  aes(x = year) +
  geom_line(aes(y = Int), size = 1, color = "Black") +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H), color = "#CC0000", alpha = 0.04, lty = "dotted") +
  theme_bw() +
  labs(x = "Year"
       , y = "Sexual Intercourse") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(1995, 2015, by=1))+
  ylim(0.9, 1.5)

5. Effect of Maturity Gap across Year _ Middle vs High

colors <- c("middle" = "#1B9E77",
            "high" = "#D95F02")
linetypes <- c("middle" = 1,
            "high" = 2)
mgap_age_a_1 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "cd_by_birthyear_m")
## New names:
## • `` -> `...10`
## • `` -> `...11`
mgap_age_b_1 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "cd_by_birthyear_h")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_a_1) +
  aes(x = year) +
  geom_line(aes(y = Int, color = "middle", lty = "middle"), size = 1) +
  geom_line(aes(y = mgap_age_b_1$Int, color = "high", lty = "high"), size = 1) +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H, color = "middle"), alpha = 0.09, lty = "dotted") +
  geom_ribbon(aes(ymin = mgap_age_b_1$CI_L, ymax = mgap_age_b_1$CI_H, color = "high"), alpha = 0.09, lty = "dotted") +
  theme_bw() +
  scale_color_manual(values = colors) +
  scale_linetype_manual(values = linetypes) + 
    labs(x = "year", 
       y = "Current Drinking",
       color = "", 
       lty = "") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(2005, 2015, by=1))+
  ylim(0.9, 1.5)

mgap_age_a_2 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "bd_t_by_birthyear_m")
## New names:
## • `` -> `...10`
## • `` -> `...11`
mgap_age_b_2 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "bd_t_by_birthyear_h")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_a_2) +
  aes(x = year) +
  geom_line(aes(y = Int, color = "middle", lty = "middle"), size = 1) +
  geom_line(aes(y = mgap_age_b_2$Int, color = "high", lty = "high"), size = 1) +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H, color = "middle"), alpha = 0.09, lty = "dotted") +
  geom_ribbon(aes(ymin = mgap_age_b_2$CI_L, ymax = mgap_age_b_2$CI_H, color = "high"), alpha = 0.09, lty = "dotted") +
  theme_bw() +
  scale_color_manual(values = colors) +
  scale_linetype_manual(values = linetypes) + 
    labs(x = "year", 
       y = "Binge Drinking",
       color = "", 
       lty = "") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(2005, 2015, by=1))+
  ylim(0.9, 1.5)

mgap_age_a_3 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "bd_c_by_birthyear_m")
## New names:
## • `` -> `...10`
## • `` -> `...11`
mgap_age_b_3 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "bd_c_by_birthyear_h")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_a_3) +
  aes(x = year) +
  geom_line(aes(y = Int, color = "middle", lty = "middle"), size = 1) +
  geom_line(aes(y = mgap_age_b_3$Int, color = "high", lty = "high"), size = 1) +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H, color = "middle"), alpha = 0.09, lty = "dotted") +
  geom_ribbon(aes(ymin = mgap_age_b_3$CI_L, ymax = mgap_age_b_3$CI_H, color = "high"), alpha = 0.09, lty = "dotted") +
  theme_bw() +
  scale_color_manual(values = colors) +
  scale_linetype_manual(values = linetypes) + 
    labs(x = "year", 
       y = "Binge Drinking (current)",
       color = "", 
       lty = "") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(2005, 2015, by=1))+
  ylim(0.9, 1.5)

mgap_age_a_4 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "riskbeh_by_birthyear_m")
## New names:
## • `` -> `...10`
## • `` -> `...11`
mgap_age_b_4 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "riskbeh_by_birthyear_h")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_a_4) +
  aes(x = year) +
  geom_line(aes(y = Int, color = "middle", lty = "middle"), size = 1) +
  geom_line(aes(y = mgap_age_b_4$Int, color = "high", lty = "high"), size = 1) +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H, color = "middle"), alpha = 0.09, lty = "dotted") +
  geom_ribbon(aes(ymin = mgap_age_b_4$CI_L, ymax = mgap_age_b_4$CI_H, color = "high"), alpha = 0.09, lty = "dotted") +
  theme_bw() +
  scale_color_manual(values = colors) +
  scale_linetype_manual(values = linetypes) + 
    labs(x = "year", 
       y = "Risky Behaviors After Drink",
       color = "", 
       lty = "") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(2005, 2015, by=1))+
  ylim(0.9, 1.5)

mgap_age_a_5 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sm_t_by_birthyear_m")
## New names:
## • `` -> `...10`
## • `` -> `...11`
mgap_age_b_5 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sm_t_by_birthyear_h")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_a_5) +
  aes(x = year) +
  geom_line(aes(y = Int, color = "middle", lty = "middle"), size = 1) +
  geom_line(aes(y = mgap_age_b_5$Int, color = "high", lty = "high"), size = 1) +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H, color = "middle"), alpha = 0.09, lty = "dotted") +
  geom_ribbon(aes(ymin = mgap_age_b_5$CI_L, ymax = mgap_age_b_5$CI_H, color = "high"), alpha = 0.09, lty = "dotted") +
  theme_bw() +
  scale_color_manual(values = colors) +
  scale_linetype_manual(values = linetypes) + 
    labs(x = "year", 
       y = "Smoking (ever)",
       color = "", 
       lty = "") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(2005, 2015, by=1))+
  ylim(0.9, 1.5)

mgap_age_a_6 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sm_c_by_birthyear_m")
## New names:
## • `` -> `...10`
## • `` -> `...11`
mgap_age_b_6 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sm_c_by_birthyear_h")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_a_6) +
  aes(x = year) +
  geom_line(aes(y = Int, color = "middle", lty = "middle"), size = 1) +
  geom_line(aes(y = mgap_age_b_6$Int, color = "high", lty = "high"), size = 1) +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H, color = "middle"), alpha = 0.09, lty = "dotted") +
  geom_ribbon(aes(ymin = mgap_age_b_6$CI_L, ymax = mgap_age_b_6$CI_H, color = "high"), alpha = 0.09, lty = "dotted") +
  theme_bw() +
  scale_color_manual(values = colors) +
  scale_linetype_manual(values = linetypes) + 
    labs(x = "year", 
       y = "Smoking (in 30 days)",
       color = "", 
       lty = "") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(2005, 2015, by=1))+
  ylim(0.9, 1.5)

mgap_age_a_7 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sex_by_birthyear_m")
## New names:
## • `` -> `...10`
## • `` -> `...11`
mgap_age_b_7 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sex_by_birthyear_h")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_a_7) +
  aes(x = year) +
  geom_line(aes(y = Int, color = "middle", lty = "middle"), size = 1) +
  geom_line(aes(y = mgap_age_b_7$Int, color = "high", lty = "high"), size = 1) +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H, color = "middle"), alpha = 0.09, lty = "dotted") +
  geom_ribbon(aes(ymin = mgap_age_b_7$CI_L, ymax = mgap_age_b_7$CI_H, color = "high"), alpha = 0.09, lty = "dotted") +
  theme_bw() +
  scale_color_manual(values = colors) +
  scale_linetype_manual(values = linetypes) + 
    labs(x = "year", 
       y = "Sexual Intercourse",
       color = "", 
       lty = "") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(2005, 2015, by=1))+
  ylim(0.9, 1.8)

6. Effect of Maturity Gap across Age

mgap_age_1 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "cd_by_age")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_1) +
  aes(x = age) +
  geom_line(aes(y = Int), size = 1, color = "Black") +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H), color = "#CC0000", alpha = 0.04, lty = "dotted") +
  theme_bw() +
  labs(x = "Age"
       , y = "Current Drink") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(12, 18, by=1))

mgap_age_2 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "bd_t_by_age")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_2) +
  aes(x = age) +
  geom_line(aes(y = Int), size = 1, color = "Black") +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H), color = "#CC0000", alpha = 0.04, lty = "dotted") +
  theme_bw() +
  labs(x = "Age"
       , y = "Binge Drinking") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(12, 18, by=1))

mgap_age_3 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "bd_c_by_age")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_3) +
  aes(x = age) +
  geom_line(aes(y = Int), size = 1, color = "Black") +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H), color = "#CC0000", alpha = 0.04, lty = "dotted") +
  theme_bw() +
  labs(x = "Age"
       , y = "Binge Drinking (current)") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(12, 18, by=1))

mgap_age_4 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "riskbeh_by_age")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_4) +
  aes(x = age) +
  geom_line(aes(y = Int), size = 1, color = "Black") +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H), color = "#CC0000", alpha = 0.04, lty = "dotted") +
  theme_bw() +
  labs(x = "Age"
       , y = "Risky Behavior after Drink") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(12, 18, by=1))

mgap_age_5 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sm_t_by_age")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_5) +
  aes(x = age) +
  geom_line(aes(y = Int), size = 1, color = "Black") +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H), color = "#CC0000", alpha = 0.04, lty = "dotted") +
  theme_bw() +
  labs(x = "Age"
       , y = "Smoking (ever)") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(12, 18, by=1))

mgap_age_6 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sm_c_by_age")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_6) +
  aes(x = age) +
  geom_line(aes(y = Int), size = 1, color = "Black") +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H), color = "#CC0000", alpha = 0.04, lty = "dotted") +
  theme_bw() +
  labs(x = "Age"
       , y = "Smoking (in 30 days)") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(12, 18, by=1))

mgap_age_7 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sex_by_age")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_7) +
  aes(x = age) +
  geom_line(aes(y = Int), size = 1, color = "Black") +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H), color = "#CC0000", alpha = 0.04, lty = "dotted") +
  theme_bw() +
  labs(x = "Age"
       , y = "Sexual Intercourse") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(12, 18, by=1))

7. Effect of Maturity Gap across Age _ 1988~1995 vs 1996~2003

colors <- c("88 to 95" = "#0000CC",
            "96 to 03" = "#CC0000")
linetypes <- c("88 to 95" = 1,
            "96 to 03" = 2)
mgap_age_a_1 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "cd_by_age_A")
## New names:
## • `` -> `...10`
## • `` -> `...11`
mgap_age_b_1 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "cd_by_age_B")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_a_1) +
  aes(x = age) +
  geom_line(aes(y = Int, color = "88 to 95", lty = "88 to 95"), size = 1) +
  geom_line(aes(y = mgap_age_b_1$Int, color = "96 to 03", lty = "96 to 03"), size = 1) +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H, color = "88 to 95"), alpha = 0.09, lty = "dotted") +
  geom_ribbon(aes(ymin = mgap_age_b_1$CI_L, ymax = mgap_age_b_1$CI_H, color = "96 to 03"), alpha = 0.09, lty = "dotted") +
  theme_bw() +
  scale_color_manual(values = colors) +
  scale_linetype_manual(values = linetypes) + 
    labs(x = "age", 
       y = "Current Drinking",
       color = "Year", 
       lty = "Year") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(12, 18, by=1))+
  ylim(0.9, 1.8)

mgap_age_a_2 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "bd_t_by_age_A")
## New names:
## • `` -> `...10`
## • `` -> `...11`
mgap_age_b_2 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "bd_t_by_age_B")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_a_2) +
  aes(x = age) +
  geom_line(aes(y = Int, color = "88 to 95", lty = "88 to 95"), size = 1) +
  geom_line(aes(y = mgap_age_b_2$Int, color = "96 to 03", lty = "96 to 03"), size = 1) +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H, color = "88 to 95"), alpha = 0.09, lty = "dotted") +
  geom_ribbon(aes(ymin = mgap_age_b_2$CI_L, ymax = mgap_age_b_2$CI_H, color = "96 to 03"), alpha = 0.09, lty = "dotted") +
  theme_bw() +
  scale_color_manual(values = colors) +
  scale_linetype_manual(values = linetypes) + 
    labs(x = "age", 
       y = "Binge Drinking",
       color = "Year", 
       lty = "Year") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(12, 18, by=1))+
  ylim(0.9, 1.8)

mgap_age_a_3 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "bd_c_by_age_A")
## New names:
## • `` -> `...10`
## • `` -> `...11`
mgap_age_b_3 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "bd_c_by_age_B")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_a_3) +
  aes(x = age) +
  geom_line(aes(y = Int, color = "88 to 95", lty = "88 to 95"), size = 1) +
  geom_line(aes(y = mgap_age_b_3$Int, color = "96 to 03", lty = "96 to 03"), size = 1) +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H, color = "88 to 95"), alpha = 0.09, lty = "dotted") +
  geom_ribbon(aes(ymin = mgap_age_b_3$CI_L, ymax = mgap_age_b_3$CI_H, color = "96 to 03"), alpha = 0.09, lty = "dotted") +
  theme_bw() +
  scale_color_manual(values = colors) +
  scale_linetype_manual(values = linetypes) + 
    labs(x = "age", 
       y = "Binge Drinking (current)",
       color = "Year", 
       lty = "Year") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(12, 18, by=1))+
  ylim(0.9, 1.8)

mgap_age_a_4 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "riskbeh_by_age_A")
## New names:
## • `` -> `...10`
## • `` -> `...11`
mgap_age_b_4 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "riskbeh_by_age_B")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_a_4) +
  aes(x = age) +
  geom_line(aes(y = Int, color = "88 to 95", lty = "88 to 95"), size = 1) +
  geom_line(aes(y = mgap_age_b_4$Int, color = "96 to 03", lty = "96 to 03"), size = 1) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H, color = "88 to 95"), alpha = 0.09, lty = "dotted") +
  geom_ribbon(aes(ymin = mgap_age_b_4$CI_L, ymax = mgap_age_b_4$CI_H, color = "96 to 03"), alpha = 0.09, lty = "dotted") +
  theme_bw() +
  scale_color_manual(values = colors) +
  scale_linetype_manual(values = linetypes) + 
    labs(x = "age", 
       y = "Risky Behaviors after Drinking",
       color = "Year", 
       lty = "Year") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(12, 18, by=1))+
  ylim(0.9, 1.8)

mgap_age_a_5 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sm_t_by_age_A")
## New names:
## • `` -> `...10`
## • `` -> `...11`
mgap_age_b_5 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sm_t_by_age_B")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_a_5) +
  aes(x = age) +
  geom_line(aes(y = Int, color = "88 to 95", lty = "88 to 95"), size = 1) +
  geom_line(aes(y = mgap_age_b_5$Int, color = "96 to 03", lty = "96 to 03"), size = 1) +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H, color = "88 to 95"), alpha = 0.09, lty = "dotted") +
  geom_ribbon(aes(ymin = mgap_age_b_5$CI_L, ymax = mgap_age_b_5$CI_H, color = "96 to 03"), alpha = 0.09, lty = "dotted") +
  theme_bw() +
  scale_color_manual(values = colors) +
  scale_linetype_manual(values = linetypes) + 
    labs(x = "age", 
       y = "Smoking (ever)",
       color = "Year", 
       lty = "Year") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(12, 18, by=1))+
  ylim(0.9, 1.8)

mgap_age_a_6 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sm_c_by_age_A")
## New names:
## • `` -> `...10`
## • `` -> `...11`
mgap_age_b_6 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sm_c_by_age_B")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_a_6) +
  aes(x = age) +
  geom_line(aes(y = Int, color = "88 to 95", lty = "88 to 95"), size = 1) +
  geom_line(aes(y = mgap_age_b_6$Int, color = "96 to 03", lty = "96 to 03"), size = 1) +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H, color = "88 to 95"), alpha = 0.09, lty = "dotted") +
  geom_ribbon(aes(ymin = mgap_age_b_6$CI_L, ymax = mgap_age_b_6$CI_H, color = "96 to 03"), alpha = 0.09, lty = "dotted") +
  theme_bw() +
  scale_color_manual(values = colors) +
  scale_linetype_manual(values = linetypes) + 
    labs(x = "age", 
       y = "Smoking (last 30 days)",
       color = "Year", 
       lty = "Year") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(12, 18, by=1))+
  ylim(0.9, 1.8)

mgap_age_a_7 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sex_by_age_A")
## New names:
## • `` -> `...10`
## • `` -> `...11`
mgap_age_b_7 <- read_excel("/Users/idlhy/Library/CloudStorage/OneDrive-개인/바탕 화면/Research/청소년건강행태조사/5. SAS print/cov_221107.xlsx", sheet = "sex_by_age_B")
## New names:
## • `` -> `...10`
## • `` -> `...11`
ggplot(mgap_age_a_7) +
  aes(x = age) +
  geom_line(aes(y = Int, color = "88 to 95", lty = "88 to 95"), size = 1) +
  geom_line(aes(y = mgap_age_b_7$Int, color = "96 to 03", lty = "96 to 03"), size = 1) +
  geom_line(aes(y = 1), size = 0.5) +
  geom_ribbon(aes(ymin = CI_L, ymax = CI_H, color = "88 to 95"), alpha = 0.09, lty = "dotted") +
  geom_ribbon(aes(ymin = mgap_age_b_7$CI_L, ymax = mgap_age_b_7$CI_H, color = "96 to 03"), alpha = 0.09, lty = "dotted") +
  theme_bw() +
  scale_color_manual(values = colors) +
  scale_linetype_manual(values = linetypes) + 
    labs(x = "age", 
       y = "Sexual Intercourse",
       color = "Year", 
       lty = "Year") +
  theme(legend.position = "bottom",
        plot.title = element_text(family = "Times New Roman", size = (16)),
        legend.title = element_text(family = "Times New Roman", size = (16)),
        legend.text = element_text(family = "Times New Roman", size = (16)),
        axis.title = element_text(family = "Times New Roman", size = (13)),
        axis.text = element_text(family = "Times New Roman", size = (16)))+ 
  scale_x_continuous(breaks = seq(12, 18, by=1))+
  ylim(0.9, 1.8)