Skip to content

Instantly share code, notes, and snippets.

@mercelsantos
mercelsantos / subset.POSIXct.R
Created July 12, 2018 14:50 — forked from rich-iannone/subset.POSIXct.R
Several examples in R on creating subsets of data via a POSIXct time object.
# Create a simple data frame for testing
df <- data.frame(POSIXtime = seq(as.POSIXct('2013-08-02 12:00'),
as.POSIXct('2013-08-06 05:00'), len = 45),
x = seq(45))
# The Subset Examples
#
# All data on 2013-08-06
sub.1 <- subset(df, format(POSIXtime,'%d')=='06')