The goal of swephR is to provide an R interface to the Swiss Ephemeris. The Swiss Ephemeris is a high precision ephemeris based upon the DE431 ephemeris from NASA’s JPL. It covers the time range 13201 BCE to 17191 CE.

Installation

You can install the released version of swephR from CRAN with:

Intermediate releases can also be obtained via drat:

This package uses the semi-analytic theory by Steve Moshier. For faster and more accurate calculations, the compressed Swiss Ephemeris data is available in the swephRdata package. To access this data package, run

install.packages("swephRdata", repos = "https://rstub.github.io/drat/", type = "source")

The size of the swephRdata package is approximately 115 MB. The user can also use the original JPL DE431 data.

Example

To compute the position of celestial body or star with SE (Swiss Ephemeris), you do the following steps:

For a specific date, compute the Julian day number (in below example: J2000.0, 1 January 2000 at 12:00 UT):

Compute (using Moshier ephemeris) the positions (longitude, latitude, distance, longitude speed and latitude speed) of a planet or other celestial bodies (in below example: the Sun):

or a fixed star (in below example: Sirius):

The current R interface is modeled after the C interface. It is therefore often helpful to consult the general documentation and programmer’s documentation for the Swiss Ephemeris.

Feedback

All feedback (bug reports, security issues, feature requests, …) should be provided as issues.