Created
July 9, 2013 22:38
-
-
Save Ironholds/5961944 to your computer and use it in GitHub Desktop.
happy? ;p
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Data on registrations | |
registrations.fun <- function(x, graphname, filename){ | |
#Aggregate | |
aggregate.data <- as.data.frame( | |
table(x$registration_date | |
) | |
) | |
#Plot registrations | |
assign("registration.plot",ggplot(data = aggregate.data, | |
aes(x=Var1, y = Freq, width=.5)) + | |
geom_bar(width=.5, fill = "red", stat = "identity", position = "dodge") + | |
labs(x = "Year", y = "Number of registrations") + | |
theme(axis.text.x=element_text(angle = -90, hjust = 1)) + | |
ggtitle(paste("English-language Wikipedia account registrations by ",graphname, sep = " ")), envir = .GlobalEnv) | |
ggsave(filename = file.path(getwd(),"Output", paste("account_registrations_by_",filename,".png", sep = "")), | |
plot = registration.plot, | |
width = 8, | |
height = 8, | |
units = "in") | |
#Write | |
aggregate_file_path <- file.path(getwd(),"Output",paste("account_registrations_by_",filename,".png", sep = "")) | |
write.table(aggregate.data, file = aggregate_file_path, col.names = TRUE, | |
row.names = FALSE, sep = "\t", quote = FALSE) | |
} | |
registrations.fun(x = query.df, filename = "year", graphname = "year") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment