Built with blockbuilder.org
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
license: gpl-3.0 |
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
license: gpl-3.0 |
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
license: gpl-3.0 | |
height: 200 |
Built with blockbuilder.org
forked from bletcher's block: transition test
forked from walkerjeffd's block: transition test 2
Built with blockbuilder.org
forked from bletcher's block: transition test
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
is.regular <- function(x) { | |
# returns TRUE if vector x of POSIXct datetimes is continuous and regular | |
# by checking if there are more than one unique difftime between each row | |
x.difftime <- difftime(x[2:length(x)], x[1:(length(x)-1)], units='secs') | |
if (length(levels(factor(x.difftime))) > 1) { | |
return (FALSE) | |
} else { | |
return (TRUE) | |
} | |
} |
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
zoo.regular <- function(dates, values, by="hour", fill=NA) { | |
# convert time series to regular zoo object | |
require(zoo) | |
z <- zoo(values, dates) | |
z <- merge(z, zoo(, seq(floor_date(start(z), 'day'), | |
ceiling_date(end(z), 'day'), | |
by)), | |
fill=fill) | |
z <- z[1:(length(z)-1)] | |
return(z) |
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
require(lubridate) | |
require(plyr) | |
require(ggplot2) | |
theme_set(theme_bw()) | |
# create random dataset | |
df <- data.frame(DATETIME = ymd("2000-01-01") + ddays(runif(100)*365*5)) | |
# compute day/month columns | |
df <- mutate(df, |
Built with blockbuilder.org