Learn R Programming

calcal (version 1.0.0)

sunrise: Sun and moon rise and set given a date and location

Description

Calculate the time of sunrise, sunset, moonrise and moonset at a specific location and date. The time zone of the location is used as specified in the location object. No adjustments are made for daylight saving.

Usage

sunrise(date, location)

sunset(date, location)

moonset(date, location)

moonrise(date, location)

Value

Time of sunrise

Arguments

date

Vector of dates on some calendar.

location

Vector of locations of class "location", usually the output from the location function

Examples

Run this code
melbourne <- location(-37.8136, 144.9631, 31, 10)
sydney <- location(-33.8688, 151.2093, 3, 10)
sunrise(gregorian_date(2025, 1, 1), c(melbourne, sydney))
sunset(gregorian_date(2025, 1, 1), c(melbourne, sydney))
moonrise(gregorian_date(2025, 1, 1), c(melbourne, sydney))
moonset(gregorian_date(2025, 1, 1), c(melbourne, sydney))

Run the code above in your browser using DataLab