From c3289148ec4e549287cd07046d07a9e57fad01f5 Mon Sep 17 00:00:00 2001 From: Brian Fannin Date: Wed, 13 Jul 2016 22:22:06 -0400 Subject: [PATCH] Add library calls. Sort out state names for maps --- 25_GettingStarted.Rmd | 4 ++++ 35_Lists.Rmd | 4 ++++ 45_BasicVisualization.Rmd | 12 ++++++------ 90_AdvancedVisualization.Rmd | 6 +++--- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/25_GettingStarted.Rmd b/25_GettingStarted.Rmd index 026064d..8f2d501 100644 --- a/25_GettingStarted.Rmd +++ b/25_GettingStarted.Rmd @@ -1,3 +1,7 @@ +```{r echo=FALSE, results='hide'} +library(pander) +``` + # Getting started ### Mathematical Operators diff --git a/35_Lists.Rmd b/35_Lists.Rmd index 19a80e6..78a0b4e 100644 --- a/35_Lists.Rmd +++ b/35_Lists.Rmd @@ -1,3 +1,7 @@ +```{r echo=FALSE, results='hide'} +library(rblocks) +``` + # Lists In this chapter, we're going to learn about lists. Lists can be a bit confusing the first time you begin to use them. Heaven knows it took me ages to get comfortable with them. However, they're a very powerful way to structure data and, once mastered, will give you all kinds of control over pretty much anything the world can throw at you. If vectors are R's atom, lists are molecules. diff --git a/45_BasicVisualization.Rmd b/45_BasicVisualization.Rmd index 0095a87..d9dca7f 100644 --- a/45_BasicVisualization.Rmd +++ b/45_BasicVisualization.Rmd @@ -94,12 +94,12 @@ lines(X1, yHat-1, lty="dotted", lwd=0.5) ```{r } library(raw) data(COTOR2) -hist(COTOR2$Claim) -boxplot(COTOR2$Claim) -plot(density(COTOR2$Claim)) -plot(density(log(COTOR2$Claim))) -hist(log(COTOR2$Claim)) -hist(COTOR2$Claim, breaks=80) +hist(COTOR2) +boxplot(COTOR2) +plot(density(COTOR2)) +plot(density(log(COTOR2))) +hist(log(COTOR2)) +hist(COTOR2, breaks=80) ``` ## Resources diff --git a/90_AdvancedVisualization.Rmd b/90_AdvancedVisualization.Rmd index b90f469..fda2a5b 100644 --- a/90_AdvancedVisualization.Rmd +++ b/90_AdvancedVisualization.Rmd @@ -202,13 +202,13 @@ library(choroplethrMaps) mapData <- subset(StateExperience, PolicyYear == 2010) mapData$value <- mapData$NumClaims -mapData$region <- mapData$Fullname +mapData$region <- tolower(mapData$Fullname) state_choropleth(mapData) ``` ### Choropleths the harder way -```{r} +```{r eval=FALSE} states_map <- map_data("state") plt <- ggplot(subset(StateExperience, PolicyYear == 2010), aes(map_id = Fullname)) @@ -220,7 +220,7 @@ plt ### Choropleths the really hard way -```{r } +```{r eval=FALSE} plt <- ggplot(StateExperience, aes(map_id = Fullname)) plt <- plt + geom_map(aes(fill = NumClaims), color = "black", map = states_map) plt <- plt + expand_limits(x = states_map$long, y = states_map$lat)