How to Create a Line Graph

This plot was created to depict trends and topics discussed in Seventeen Magazines Traumarama Articles from 1994-2007. In order to create this plot, complete the following steps:

Step 1

Year <- c("1994-1995", "1997", "1999", "2002", "2005", "2007", "1994-1995", 
    "1997", "1999", "2002", "2005", "2007", "1994-1995", "1997", "1999", "2002", 
    "2005", "2007", "1994-1995", "1997", "1999", "2002", "2005", "2007", "1994-1995", 
    "1997", "1999", "2002", "2005", "2007")
Trauma.Type <- c("Boy", "Boy", "Boy", "Boy", "Boy", "Boy", "Body", "Body", "Body", 
    "Body", "Body", "Body", "Smarts", "Smarts", "Smarts", "Smarts", "Smarts", 
    "Smarts", "Other", "Other", "Other", "Other", "Other", "Other", "Total", 
    "Total", "Total", "Total", "Total", "Total")
Frequency <- c(63, 60, 63, 40, 57, 37, 52, 35, 35, 55, 74, 72, 9, 4, 8, 6, 24, 
    12, 15, 16, 19, 7, 16, 19, 107, 98, 121, 86, 155, 140)
trauma <- data.frame(Year = Year, Trauma.Type = Trauma.Type, Frequency = Frequency)

Step 2

library(ggplot2)

Step 3

ggplot(trauma, aes(x = Year, y = Frequency, group = Trauma.Type)) + geom_line(aes(colour = Trauma.Type))

plot of chunk unnamed-chunk-3

Step 4

ggplot(trauma, aes(x = Year, y = Frequency, group = Trauma.Type)) + geom_line(aes(colour = Trauma.Type)) + 
    geom_point(pch = 18, size = 4)

plot of chunk unnamed-chunk-4

Step 5

ggplot(trauma, aes(x = Year, y = Frequency, group = Trauma.Type)) + geom_line(aes(colour = Trauma.Type)) + 
    geom_point(pch = 18, size = 4) + scale_colour_discrete(breaks = c("Body", 
    "Boy", "Smarts", "Other", "Total"), name = "Trauma Type")

plot of chunk unnamed-chunk-5

Your line graph is now complete!