# Valentines-day full moon

**Dan Kelley Blog/R**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

# Introduction

A wise person told me that it will be a full moon on the upcoming Valentine’s Day, but that it will be a long time until another one. I decided to check this with astronomical calculation.

# Procedure

The Oce package has a function called `moonAngle()`

that returns, among other things, the illuminated fraction of the moon visible at any given time. This can be used to test for a full moon on Valentine’s day.

The first step is to construct the times of Valentine’s days, starting with the one this year. Then the illuminated fraction can be calculated (here, for Halifax, the lover’s capital of Canada), and that fraction can be plotted for each of the next fifty years, with red dots for the romantic times, and blue ones for the so-sad ones.

1 2 | times <- seq(as.POSIXct("2014-02-14"), length.out = 50, by = "year") library(oce) |

## Loading required package: methods ## Loading required package: mapproj ## Loading required package: maps

1 2 3 4 | fraction <- moonAngle(times, lon = -63, lat = 43)$illuminatedFraction full <- fraction > 0.99 plot(times, fraction, xlab = "Year", ylab = "Moon Illuminated Fraction", col = ifelse(full, "red", "blue"), pch = 16, cex = 2) |

Here, red has been used to indicate years with full moon on Valentine’s Day, and sad blue otherwise.

# Results

Yes, it will be a long time until the next full moon on Valentine’s Day:

1 | times[full] |

## [1] "2014-02-14 AST" "2033-02-14 AST" "2052-02-14 AST"

# Conclusions

Buy candy now.

- Source code: 2014-04-13-valentine-moon.R

**leave a comment**for the author, please follow the link and comment on their blog:

**Dan Kelley Blog/R**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.