Skip to content

Instantly share code, notes, and snippets.

@BillPetti
Last active January 17, 2017 21:48
Show Gist options
  • Save BillPetti/fc4fc5af30029fee3604 to your computer and use it in GitHub Desktop.
Save BillPetti/fc4fc5af30029fee3604 to your computer and use it in GitHub Desktop.
A function to check on how long until opening day
is_it_opening_day <- function(x) {
openingday <- as.Date("2017-04-03")
if ((openingday - Sys.Date()) > 1) {print(paste0("Nope. We've still got ", (openingday - Sys.Date()), " days to go. Stay strong."))} else
if ((openingday - Sys.Date()) == 1) {print(paste0("Nope, opening night is not the same thing as opening day. We've still got 1 day to go. But there are a few games on tonight."))}
else
if ((Sys.Date() - openingday) > 1) {print(paste0("Seriously? The season started ", (Sys.Date() - openingday), " days ago. Go watch some baseball!"))}
else
if ((Sys.Date() - openingday) == 1) {print(paste0("The season started yesterday. Go watch some baseball!"))}
else {print("Yes! Rejoice! It's Opening Day, All's right with the world.")}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment