Sunsets in Google Calendar using R

I live (and work!) near one of the most beautiful vantage points for sunsets in possibly the entire US.

Sunset from the Brooklyn Heights Promenade

However almost every beautiful sunset I have seen from there has come from either 1) me walking out of work and noticing that the sky is bright pink, or 2) seeing someone post a sunset photo on Twitter (I know). Either way it ends with me practically sprinting to the Brooklyn Heights Promenade for the tail end of the sunset.

So, I decided to create some Google Calendar “appointments” for myself, using R and specifically the sunrise.set() function (thanks Carlos!). Because I’m a big user of Google Now, this means that–based on my location and travel time–my phone will buzz at me and tell me to leave for the Promenade in time to see the sunset.

Assuming you don’t live near me, you might want to customize your calendar to include the address of your own favorite vantage point for sunsets. So, I used this opportunity to create my personal R package and put this in as the first function. You can input your own address, timezone, etc. into the create_sunset_cal() function, and it will output a .CSV that meets Google’s requirements for importing a calendar. To get the function, just run the following:

library('devtools')
install.packages('StreamMetabolism')
install_github(repo = 'hilaryparker/hilary')
library('hilary')

You can upload the .CSV directly into your Google calendar (just be careful as it will import a different event for every day, so if you do it mistakenly it will be a pain to remove!). I’ll give instructions for creating a new calendar just for the sunsets, so you can remove it whenever you want if your calendar looks too cluttered.

  1. Create a new calendar, called “Sunset”. If you want to share the calendar, make it Public.Screen Shot 2014-05-26 at 2.15.08 PM
  2. Under the “Other calendars” heading, click on “Import calendar”.Screen Shot 2014-05-26 at 2.30.34 PM
  3. Select the .CSV you created using the create_sunset_cal() function, making sure you select your newly-created “Sunset” calendar.Screen Shot 2014-05-26 at 2.33.24 PM
  4. Henceforth be notified about the travel time to the sunset! Screenshot_2014-05-26-20-08-00~2
  5. Enjoy the fruits of your labor.2013-11-12 17.23.03

 

16 thoughts on “Sunsets in Google Calendar using R

  1. Pingback: Sunsets in Google Calendar using R | R for Jour...

  2. Pingback: Sunsets in Google Calendar using R ← Patient 2 Earn

  3. Pingback: Sunsets in Google Calendar (for R noobs) » Just Trying To Have A Friday, You Guys

  4. Pingback: Links & reads for 2014 Week 23 | Martin's Weekly Curations

  5. Pingback: Sunsets in Google Calendar using R | R for Jour...

  6. This is good stuff. I love it when one connects everyday tools(maybe R would not be considered everyday by most, but indulge me) and solves a problem that matters to oneself. No need to wait to solve the massive big problems.

  7. Really nice, thanks for sharing. It reminds me of an idea I had for an app called – find sunlight – for here in the iron jungle that is NYC. It would take the height of the buildings, the daily path of the sun, and tell you where in NYC there is sunlight. We need that vitamin D🙂. Of course, I don’t have the skills to make this happen though lol.

  8. Pingback: Calendar Hacks « Code as Craft

  9. Ahoy hoy,
    Thanks for doing this, so awesome. I just tried it out for 2 weeks, I think it’ll be a nice thing to do. For some reason I needed to install the package “StreamMetabolism” in order to get this to work – just thought you might like to know.
    Thanks for being Awesome!

  10. Pingback: Ceiba3D Studio | Calendar Hacks – Code as Craft

Comment Away!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s