Processing math: 100%
  • Part 1: Babyname Trend
  • Part 2: Markdown Examples

Files with extension .Rmd are R Markdown files. We are going to practice compiling .Rmd files, i.e. knit them, to HTML pages.

  1. Change the name of the author above to yours and change the date.
  2. Complete the work in the sections below, periodically “Knitting” to make sure things work.
  3. Once you feel you are done, in the resulting pop-up window of an HTML page, click on “Publish” (in blue on the top-right) -> RPubs -> Publish.
    • Create an RPubs account
    • Give it
      • Title: “YOUR NAME Problem Set 01”
      • “slug” i.e. URL completion: problem_set_01
  4. Your analysis is now online and visible to the world! You can update what’s online by repeating the previous 2 steps.
  5. Copy the URL of the resulting RPubs page and complete the submission form on the Problem Set page

Part 1: Babyname Trend

Using a combination of Google, your instincts, and/or trial and error, find an one example of a name for a given sex whose popularity trend you find interesting. Add a sentence or two about your hypothesis as to why we see this trend. You’ll be copying over code from the example babynames.Rmd done in class for Lec03 below:

# Load packages
library(ggplot2)
library(dplyr)
library(babynames)
baby_name <- "James"
baby_sex <- "M"

single_name <- babynames %>% 
  filter(name==baby_name & sex==baby_sex)

ggplot(data=single_name, mapping = aes(x=year, y=prop)) + 
  geom_line() +
  xlim(c(1880, 2014)) +
  ylim(c(0, NA)) +
  xlab("Year") +
  ylab(paste("Prop. of ", baby_sex, " born with name ", baby_name, sep=""))

The name James has been on a downwards trend from around 1945. It could be the effects of religion dying out in america, since it is also the name of a major figure in the bible. It is at an all time low in the 21st century because the mindset of parents today is very different from parents in the 1940s. The name may have also just gotten tired out.

Part 2: Markdown Examples

You do not need to do submit anything in this section, but please give it a quick read:

What is R Markdown? It’s R + Markdown. What is Markdown? Markdown is a way to quickly write HTML code to publish to a webpage. We will be learning these on an “as needed basis”, but take a look and the commands below, and see what they look like after you Knit the page; they are rather simple to understand. You can see a full list of Markdown commands by going to RStudio menu bar -> Help -> Markdown Quick Reference.

Quick lists:

  • Hello world
  • My name is Albert
    • Make sublists
    • Yeah

Quick URLs: https://www.nhl.com/

Quick numbered lists:

  1. Blah
  2. Blah
  3. Blah

Tables:

First Header Second Header
Content Cell Content Cell
Content Cell Content Cell

LaTeX for fancy math equations:

12πσ2exp((xμ)22σ2)