Skip to content

Instantly share code, notes, and snippets.

@ttmmghmm
Last active September 29, 2015 11:23
Show Gist options
  • Save ttmmghmm/a4bc1a0e262ee9aab6d9 to your computer and use it in GitHub Desktop.
Save ttmmghmm/a4bc1a0e262ee9aab6d9 to your computer and use it in GitHub Desktop.
misc
# http://blog.revolutionanalytics.com/2014/10/introducing-minicran.html
library("miniCRAN")
sessionInfo()
pkgs <- c("chron")
pkgDep(pkgs)
p <- makeDepGraph(pkgs, enhances = TRUE)
?plot.pkgDepGraph
set.seed(20140917)
plot(p, cex=1.5, vertex.size=15)
library(weatherData)
# http://www.wunderground.com/history/airport/EGLL/2015/4/12/DailyHistory.html?format=1
hth <- getWeatherForDate("EGLL",
start_date= Sys.Date()-1, end_date = Sys.Date(), # last two days.
opt_detailed = TRUE, opt_all_columns = TRUE)
n <- 3 # this day for last n years.
(yrs <- seq(Sys.Date(), Sys.Date() - 365*n, length.out = n+1))
hthYrly <- lapply(yrs, function(ii) getWeatherForDate("EGLL",
start_date= ii, # no end date so only one day returned.
opt_detailed = TRUE, opt_all_columns = TRUE,
station_type = "airportCode", opt_verbose = TRUE))
names(hthYrly) <- yrs
str(hthYrly)
library(dplyr)
library(sparklines);
sapply(hthYrly[1], function(ii) sparkline(ii$TemperatureC, "line"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment