Jun 042014
 

If you saw Hilary Parker‘s awesome post Sunsets in Google Calendar using R and got all excited about it, but have no idea how to use R, fear not. This post will help you go the distance!

First, install R. I myself use MacPorts

Susnset statue of Liberty

Susnset statue of Liberty (Photo credit: Adorenomis)

, so I did:

$ sudo port install R

which took a while and had a lot of dependencies, but whatevs, it eventually worked…

Next, save Hilary’s createsunsetcal.R file somewhere on your computer.

Open that up and modify it to use your own sunset location and lat/lon coordinates (I used Google Maps and looked at the lat/lon coordinates in the URL to fill in the data I wanted). Save it.

Now, in that same folder, open an R prompt like so and do the following:

$ R

> install.packages(“StreamMetabolism”)

… (follow the prompts here, choose a mirror, etc.)

> library(StreamMetabolism)

> source(“/path/to/downloaded/file/createsunsetcal.R”)

> createsunsetcal()

then <control> + d to exit your R session.

Congrats, you should now see a file called sunset.csv, hooray!

Thanks for the awesome write-up Hilary.

Enhanced by Zemanta

  3 Responses to “Sunsets in Google Calendar (for R noobs)”

  1. You can download a pre-build R.app

    http://cran.r-project.org/bin/macosx/

  2. Similar process for homebrew, just

    > brew tap homebrew/science
    > brew install r

  3. Thanks for the tips gents!

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)