Files corresponding to Short Course: Introduction to Data Science Using R
We’ll be continuing from a previous exercise. The code we’ll need is below.
# packages
library(tidyverse)
library(dcData)
# data intake
data("BabyNames", package = "dcData")
BabyNamesSupp <- read_csv("https://github.com/jbpost2/Basics-of-R-for-Data-Science-and-Statistics/raw/master/datasets/BabyNamesSupp.csv")
Create a new .Rmd file (using File –> New File –> R Markdown then choose HTML as the output type).
“Knit” the document to render the initial HTML document. This will require you to save the .Rmd file.
Update yaml header as necessary to include an informative title, author name, & relevant date.
---
title: "Add a title"
author: "Add your name"
date: "Pick a date"
output: html_document
---
After the YAML header and after the first R code chunk, replace the text with the following (which includes a header and a list):
Investigating Names
We’ll be investigating the popularity of names in the US each year. The names of interest are:
Knit this document to see the changes!
In the first code chunk (pre-made in the document), read in the
tidyverse
and dcData
packages using two library()
function
calls.
Create a 2nd R code chunk below the text from 5.2 and place the code that reads in the two names data sets (given above).
Delete the rest of the pre-made text and code below and knit the document.
1st code chunk
library(tidyverse)
library(dcData)
2nd code chunk
data("BabyNames", package = "dcData")
BabyNamesSupp <- read_csv("https://github.com/jbpost2/Basics-of-R-for-Data-Science-and-Statistics/raw/master/datasets/BabyNamesSupp.csv")