Skip to main content

I live (and work!) near one of the most beautiful vantage points for sunsets in possibly the entire US. 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.

For those not familiar the statistical software R, you may think of it as an overcomplicated program reserved only for statisticians buried under a colossal amount of data. But it’s also surprisingly versatile – here is a simple example of what you can do in R.

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.

First in R, you will need to install the ‘devtools’ package. Then you can input your own address, timezone, etc. into the create_sunset_cal() function, and it will output a .CSV file that meets Google’s requirements for importing a calendar. The default is set to my vantage point in Brooklyn, to get the function, just run the following in R:


To set the location to wherever you are, you can change the default arguments in the create_sunset_cal() function. So for example, the web editor of Significance in London ran the following (you can find the ‘lat’ and ’long’ values in the url if you look up your location on Google Maps):

 lat = 51.5389528,
 long = -0.1606632,
 timezone = "Europe/London",
 num.days = 365,
 location = "Primrose Hill, Berkeley Lodge, Berkley Grove, London, NW1 8XY")

A .CSV file will then be created in your specified directory. 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.

2. Under the 'Other calendars' heading, click on 'Import calendar'.

3. Select the .CSV you created using the create_sunset_cal() function, making sure you select your newly-created 'Sunset' calendar.

4. Henceforth be notified about the travel time to the sunset!

5. Enjoy the fruits of your labor.


This article first appeared on Hilary Parker's 'Not So Standard Deviations' blog.

Leave a Reply

Significance Magazine