Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added library scales for cleaner code at line 25 #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/chapter1.r
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ library(vioplot)
library(ascii)
library(corrplot)
library(descr)
library(scales)

# Import the datasets needed for chapter 1
PSDS_PATH <- file.path('~', 'statistics-for-data-scientists')
Expand All @@ -21,7 +22,7 @@ airline_stats <- read.csv(file.path(PSDS_PATH, 'data', 'airline_stats.csv'), str
airline_stats$airline <- ordered(airline_stats$airline, levels=c('Alaska', 'American', 'Jet Blue', 'Delta', 'United', 'Southwest'))
## Code to create state table
state_asc <- state
state_asc[["Population"]] <- formatC(state_asc[["Population"]], format="d", digits=0, big.mark=",")
state_asc[["Population"]] <- scales::comma(state_asc[["Population"]])
ascii(state_asc[1:8,], digits=c(0, 0,1), align=c("l", "l", "r", "r"), caption="A few rows of the +data.frame state+ of population and murder rate by state.")

## Code snippet 1.1
Expand Down