Skip to content

Instantly share code, notes, and snippets.

@josephdunn
Created September 23, 2011 20:03
Show Gist options
  • Save josephdunn/1238323 to your computer and use it in GitHub Desktop.
Save josephdunn/1238323 to your computer and use it in GitHub Desktop.
require(xts)
data(sample_matrix)
dates <- as.POSIXct(rownames(sample_matrix), format = "%Y-%m-%d")
dayLookup <- 1:7
names(dayLookup) <- c("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
datesDays <- dayLookup[weekdays(dates, abbreviate = TRUE)]
print(datesDays)
blah <- xts(cbind(sample_matrix, dow =datesDays), order.by = dates)
blah[blah$dow!=5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment