Open Government Data Platform India
September 14, 2014 1 Comment
I found many datasets in this site but many of them are not useful. Some of them are just junk and others are not useful for predictive analytics.
But I found one that I actually used. The y-axis labels are smudged but that can be fixed.
The data is JSON which I parsed.
library(RJSONIO) library(ggplot2) library(reshape2) library(grid) this.dir <- dirname(parent.frame(2)$ofile) setwd(this.dir) airlines = fromJSON("json") df <- sapply(airlines$data,unlist) df <- data.frame(t(df)) colnames(df) <- c( (airlines[[1]][[1]])[[2]], (airlines[[1]][[2]])[[2]], (airlines[[1]][[3]])[[2]], (airlines[[1]][[4]])[[2]], (airlines[[1]][[5]])[[2]], (airlines[[1]][[6]])[[2]], (airlines[[1]][[7]])[[2]], (airlines[[1]][[8]])[[2]], (airlines[[1]][[9]])[[2]],(airlines[[1]][[10]])[[2]] ) df.melted <- melt(df, id = "YEAR") print(class(df.melted$value)) df.melted$value<-as.numeric(df.melted$value) df.melted$value <- format(df.melted$value, scientific = FALSE) print(ggplot(data = df.melted, aes(x = YEAR, y = value, color = variable)) +geom_point() + theme(axis.text.x = element_text(angle = 90,hjust = 0.9)) + theme(axis.text.y = element_text(angle = 360, hjust = 1, size=7.5, vjust=1))+ theme(plot.margin =unit(c(3,1,0.5,1), "cm")) + ylab("") + theme(legend.text=element_text(size=6)))
This is the sample data.
head(df) YEAR INTERNATIONAL ACM (IN NOS) DOMESTIC ACM (IN NOS) TOTAL ACM (IN NOS) 1 1995-96 92515 314727 407242 2 1996-97 94884 324462 419346 3 1997-98 98226 317531 415757 4 1998-99 99563 325392 424955 5 1999-00 99701 368015 467716 6 2000-01 103211 386575 489786 INTERNATIONAL PAX (IN NOS) DOMESTIC PAX (IN NOS) TOTAL PAX (IN NOS) 1 11449756 25563998 37013754 2 12223660 24276108 36499768 3 12782769 23848833 36631602 4 12916788 24072631 36989419 5 13293027 25741521 39034548 6 14009052 28017568 42026620 INTERNATIONAL FREIGHT (IN MT) DOMESTIC FREIGHT (IN MT) TOTAL FREIGHT (IN MT) 1 452853 196516 649369 2 479088 202122 681210 3 488175 217405 705580 4 474660 224490 699150 5 531844 265570 797414 6 557772 288373 846145
Hi, constantly i used to check blog posts here in the early hours in the dawn, since i
love to gain knowledge of more and more.