Skip to content

Commit

Permalink
Add library calls. Sort out state names for maps
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Fannin authored and Brian Fannin committed Jul 14, 2016
1 parent fc46b41 commit c328914
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 4 additions & 0 deletions 25_GettingStarted.Rmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
```{r echo=FALSE, results='hide'}
library(pander)
```

# Getting started

### Mathematical Operators
Expand Down
4 changes: 4 additions & 0 deletions 35_Lists.Rmd
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
12 changes: 6 additions & 6 deletions 45_BasicVisualization.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions 90_AdvancedVisualization.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)
Expand Down

0 comments on commit c328914

Please sign in to comment.