-- Leo's gemini proxy

-- Connecting to gemlog.blue:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

Prevalence of Drug Use Disorders by age

Prevalence, "Share (%) of the population suffering from drug use disorders By Age(10-49). "


Software required to recreate plot:

Install: R language, RTools40 and RStudio (see link below)

Packages: GGPLot2, dplyr, janitor.

Download code and data from Github.com (see link below).

Move R code and data to the working directory




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

-- Response ended

-- Page fetched on Thu Mar 28 12:39:12 2024