Skip to content

Commit

Permalink
Merge branch 'master' of github.com:johnmyleswhite/ML_for_Hackers
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmyleswhite committed Sep 21, 2012
2 parents 0618af3 + b58488c commit 29522f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion 01-Introduction/ufo_sightings.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# Load libraries and data
library(ggplot2) # We'll use ggplot2 for all of our visualizations
library(plyr) # For data manipulation
library(scales)
library(scales) # We'll need to fix date formats in plots

# This is a tab-delimited file, so we use 'read.delim' and set the separator as a tab character.
# We also have to alter two defaults; first, we want the strings to not be converted to
Expand Down Expand Up @@ -119,6 +119,7 @@ head(ufo.us)
quick.hist <- ggplot(ufo.us, aes(x = DateOccurred)) +
geom_histogram() +
scale_x_date(breaks = "50 years")

ggsave(plot = quick.hist,
filename = file.path("images", "quick_hist.pdf"),
height = 6,
Expand Down Expand Up @@ -217,6 +218,7 @@ ggsave(plot = state.plot,

# Create a new graph where the number of signtings is normailzed by the state population
state.pop <- read.csv(file.path('data/census.csv'), stringsAsFactors=FALSE)

state.pop$abbs <- sapply(state.pop$State, function(x) state.abb[grep(paste('^', x, sep=''), state.name)])
all.sightings$Sightings.Norm <- sapply(1:nrow(all.sightings),
function(i) all.sightings$Sightings[i] / state.pop$X2000[which(state.pop$abbs== all.sightings$State[i])])
Expand Down
1 change: 1 addition & 0 deletions package_installer.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ cran.packages <- c("e1071",
"RCurl",
"reshape",
"RJSONIO",
"scales"
"tm",
"XML")

Expand Down

0 comments on commit 29522f7

Please sign in to comment.