R Snippets

How to combine several date columns into one: weather <- data.frame(Year.UTC=c(2012, 2013), Month.UTC=c(1,2), Day.UTC=c(1,2), Hour.UTC=c(22,23)) weather <- within(weather, datetime <- as.POSIXct(paste(Year.UTC, Month.UTC, Day.UTC, Hour.UTC, sep=”-“), format=”%Y-%m-%d-%H”, tz=”UTC”)) Link Plot multiple histograms in vertical stack based on a factor library(ggplot2) library(ggplot2) ggplot(movies, aes(x = rating)) geom_histogram(binwidth = 0.5, aes(fill =factor(Comedy))) + facet_grid(Comedy~.) Link Check the column … [Read more…]