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

Update ufo_sightings.R FOR R version 3.4.1 #49

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
8 changes: 4 additions & 4 deletions 01-Introduction/ufo_sightings.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ head(ufo.us)
# We can do this by creating a histogram of frequencies for UFO sightings over time
quick.hist <- ggplot(ufo.us, aes(x = DateOccurred)) +
geom_histogram() +
scale_x_date(breaks = "50 years")
scale_x_date(date_breaks = "50 years",date_labels = "%Y")

ggsave(plot = quick.hist,
filename = file.path("images", "quick_hist.pdf"),
Expand All @@ -134,7 +134,7 @@ new.hist <- ggplot(ufo.us, aes(x = DateOccurred)) +
geom_histogram(aes(fill='white', color='red')) +
scale_fill_manual(values=c('white'='white'), guide="none") +
scale_color_manual(values=c('red'='red'), guide="none") +
scale_x_date(breaks = "50 years")
scale_x_date(date_breaks = "50 years",date_labels = "%Y")

ggsave(plot = new.hist,
filename = file.path("images", "new_hist.pdf"),
Expand Down Expand Up @@ -204,7 +204,7 @@ state.plot <- ggplot(all.sightings, aes(x = YearMonth,y = Sightings)) +
facet_wrap(~State, nrow = 10, ncol = 5) +
theme_bw() +
scale_color_manual(values = c("darkblue" = "darkblue"), guide = "none") +
scale_x_date(breaks = "5 years", labels = date_format('%Y')) +
scale_x_date(date_breaks = "5 years", date_labels = "%Y") +
xlab("Years") +
ylab("Number of Sightings") +
ggtitle("Number of UFO sightings by Month-Year and U.S. State (1990-2010)")
Expand All @@ -229,7 +229,7 @@ state.plot.norm <- ggplot(all.sightings, aes(x = YearMonth,y = Sightings.Norm))
facet_wrap(~State, nrow = 10, ncol = 5) +
theme_bw() +
scale_color_manual(values = c("darkblue" = "darkblue"), guide = "none") +
scale_x_date(breaks = "5 years", labels = date_format('%Y')) +
scale_x_date(date_breaks = "5 years", date_labels = "%Y") +
xlab("Years") +
ylab("Per Capita Number of Sightings (2000 Census)") +
ggtitle("Number of UFO sightings by Month-Year and U.S. State (1990-2010)")
Expand Down