💾 Archived View for gemlog.blue › users › cariboudatascience › 1613266872.gmi captured on 2023-04-26 at 14:56:30. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-04)

-=-=-=-=-=-=-

Prevalence of Drug Use Disorders by age

Software required to recreate plot:

Run code:

library(ggplot2)
library(scales)
library(dplyr)
library(janitor)
## Read Data
rm(list=ls())
df <- read.csv("./prevalence-of-drug-use-disorders-by-age.csv")
df <- clean_names(df)
colnames(df) <- c("County","Code","Year","age_14","age_19","age_24",
                  "age_29","age_34","all_age_percent","male_14","age_49",
                                   "age_70","standard_percent")
US <- df %>% filter(Code=="USA") %>% select(Year:standard_percent)
str(df)
## 
ggplot(US) + geom_line(aes(x=Year,y=standard_percent)) +
  labs(title="Standard Percent")
##
ggplot(US) + geom_line(aes(x=Year,y=age_14,col="age_14")) +
  geom_line(aes(x=Year,y=age_19,col="age_19")) +
  geom_line(aes(x=Year,y=age_24,col="age_24")) +
  geom_line(aes(x=Year,y=age_24,col="age_24")) +
  geom_line(aes(x=Year,y=age_29,col="age_29")) +
  geom_line(aes(x=Year,y=age_34,col="age_34")) +
  geom_line(aes(x=Year,y=age_49,col="age_49")) +
  labs(title = "prevalence-of-drug-use-disorders-by-age: 10-49 Years",
       y="prevalence (%) ") +
  guides(color = guide_legend(override.aes = list(size = 2)))

Plot:

Prevalence Of Drug Use by Age

Resources:

R Code, data

R Language and Rtools40 (click and "base" and "Rtools")

Download and install RStudio

Caribou Data Science(YouTube)

Lagrange Gemini Browser

This Gemini Capsule