swephR v0.2.1

0

Monthly downloads

0th

Percentile

High Precision Swiss Ephemeris

The Swiss Ephemeris (version 2.08) is a high precision ephemeris based upon the DE431 ephemerides from NASA's JPL. It covers the time range 13201 BCE to 17191 CE. 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.

Readme

Travis build
status AppVeyor build
status Coverage
status CRAN
status Downloads Dependencies

swephR

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 BC to AD 17191.

Installation

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

install.packages("swephR")

Intermediate releases can also be obtained via drat:

if (!requireNamespace("drat", quietly = TRUE)) install.packages("drat")
drat::addRepo("rstub")
install.packages("swephR")

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:

library(swephR)
data(SE)
swe_version()
#> [1] "2.08"

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

year <- 2000
month <- 1
day <- 1
hour <- 12
jdut <- swe_julday(year, month, day, hour, SE$GREG_CAL)
jdut
#> [1] 2451545

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):

ipl <- SE$SUN
iflag <- SE$FLG_MOSEPH + SE$FLG_SPEED
result <- swe_calc_ut(jdut, ipl, iflag)
result
#> $return
#> [1] 260
#>
#> $xx
#> [1]  2.803689e+02  2.323265e-04  9.833276e-01  1.019432e+00 -8.922802e-07
#> [6] -7.339410e-06
#>
#> $serr
#> [1] ""

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

starname = "sirius"
result <- swe_fixstar2_ut(starname, jdut, iflag)
result
#> $return
#> [1] 260
#>
#> $starname
#> [1] "Sirius,alCMa"
#>
#> $xx
#> [1]  1.040853e+02 -3.960507e+01  5.439322e+05  4.643164e-05 -7.119376e-05
#> [6] -4.130539e-03
#>
#> $serr
#> [1] ""

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.

Functions in swephR

Name Description
Section15 Section 15: Sidereal time
Section7 Section 7: Date and time conversion functions
Section6 Section 6: Eclipses, Risings, Settings, Meridian Transits, Planetary Phenomena
Section8 Section 8: Delta T-related functions
Section9 Section 9: The function for calculating topocentric planet position
swephR-package swephR: High Precision Swiss Ephemeris
Section16 Section 16.7: Other functions that may be useful
Section14 Section 14: House position calculations
Section3 Section 3: Find a planetary or asteroid name
Section10 Section 10: Sidereal mode functions
SE Constants used in swephR
Section2 Section 2: Computing positions
Section13 Section 13: House cusp, ascendant and Medium Coeli calculations
Section4 Section 4: Fixed stars functions
Section1 Section 1: The Ephemeris file related functions
No Results!

Vignettes of swephR

Name
swephR.Rmd
No Results!

Last month downloads

Details

Type Package
License AGPL | file LICENSE
LinkingTo Rcpp
RoxygenNote 6.1.1
Encoding UTF-8
URL https://github.com/rstub/swephR/, https://rstub.github.io/swephR/, http://www.astro.com/swisseph/
BugReports https://github.com/rstub/swephR/issues/
Additional_repositories https://rstub.github.io/drat
VignetteBuilder knitr
LazyData true
NeedsCompilation yes
Packaged 2019-07-08 08:38:25 UTC; ralf
Repository CRAN
Date/Publication 2019-07-08 10:30:02 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/swephR)](http://www.rdocumentation.org/packages/swephR)