# CRAN packages in R for astronomy

The **Comprehensive R Analysis Network (CRAN)** is a collection of ~5000 extension packages to the public domain R statistical software system. It has been growing exponentially since 2001. This page is an attempt to maintain an up-to-date listing of CRAN packages written specifically for astronomy, given in order of most recently added/modified.

### Listed alphabetically

**astro: Astronomy functions, tools and routines **

**astroFns: Astronomy: time and position functions, misc. utilities**

**astrolibR: Astronomy Users Library**

**celestial: Collection of common astronomical conversion routines **

**cosmoFns: Functions for cosmological distances, times, luminosities, etc**

**CosmoPhotoz: Photometric redshift estimation using generalized linear models**

**CRAC: Cosmology R Analysis Code**

**FITSio: FITS (Flexible Image Transport System) utilities**

**IRACpm (not in CRAN)**

**lira: LInear Regression in Astronomy**

**magicaxis: Pretty scientific plotting with minor-tick and log minor-tick support**

**moonsun: Basic astronomical calculations with R**

**ProFit: Fit projected 2D profiles to galaxy images**

### RMultiNest (not in CRAN)

**RobPer: Periodogram methods for irregularly samples time series **

**RStars: Access to the Digital Universe Data set API**

**SCEPtER: Stellar CharactEristics Pisa Estimation gRid**

**SCEPtERextras: Additional grids for SCEPtER**

**snapshot: Gadget N-body simulation code snapshot I/O utilities **

**SOPIE: Non-parametric estimation of the off-pulse interval of a pulsar**

**SPADAR: Spherical Projections of Astronomical Data**

**sphereplot: Spherical plotting**

**stellaR: stellar evolution tracks and isochrones**

**UPMASK: Unsupervised Photometric Membership Assignment in Stellar Clusters**

### Listed by most recent version

**SPADAR: Spherical Projections of Astronomical Data**

**(ver 1.0, 2017-04-30, Alberto Krone-Martins)**

Provides easy to use functions to create all-sky grid plots of widely used astronomical coordinate systems (equatorial, ecliptic, galactic) and scatter plots of data on any of these systems including on-the-fly system conversion. It supports any type of spherical projection to the plane defined by the 'mapproj' package.

**ProFit: Fit projected 2D profiles to galaxy images**

**(ver 1.0.2, 2017-03-17, Aaron Robotham) **

ProFit is a Bayesian galaxy fitting tool that uses a fast C++ image generation library and a flexible interface to a large number of likelihood samplers.

**lira: LInear Regression in Astronomy**

**(ver 1.2.0, 2016-03-21, Mauro Sereno)**

Package for Bayesian linear regression in astronomy. The method accounts for heteroscedastic errors in both the independent and the dependent variables, intrinsic scatters (in both variables), time evolution of slopes, normalization and scatters, Malmquist and Eddington bias, and break of linearity. The posterior distribution of the regression parameters is sampled with a Gibbs method exploiting the JAGS library.

**SOPIE: Non-parametric estimation of the off-pulse interval of a pulsar**

**(ver 1.5, 2015-09-28, Willem Daniel Schutte)**

Provides functions to non-parametrically estimate the off-pulse interval of a source function originating from a pulsar. The technique is based on a sequential application of P-values obtained from goodness-of-fit tests for the uniform distribution, such as the Kolmogorov-Smirnov, Cramer-von Mises, Anderson-Darling and Rayleigh goodness-of-fit tests.

**RStars: Access to the Digital Universe Data set API**

**(ver 1.0, 2014-12-04, William Kyle Hamilton)**

Access to the Digital Universe Data set API pulls data on exoplants, stars, and galaxies.

### RobPer: Periodogram methods for irregularly samples time series

(ver 1.2, 2014-10-3, Anita M. Thieler, Jonathan Rathjens and Roland Fried)

Package to calculate periodograms based on (robustly) fitting periodic functions to light curves (irregularly observed time series, possibly with measurement accuracies, occurring in astroparticle physics). Three main functions are included: RobPer calculates the periodogram. Outlying periodogram bars (indicating a period) can be detected with betaCvMfit. Artificial light curves can be generated using the function tsgen. For more details see Thieler, Fried and Rathjens (2013).

**UPMASK: Unsupervised Photometric Membership Assignment in Stellar Clusters**

**(ver 1.0, 2014-09-16, Alberto Krone-Martins)**

An implementation of the UPMASK method for performing membership assignment in stellar clusters in R. It is prepared to use photometry and spatial positions, but it can take into account other types of data. The method is able to take into account arbitrary error models, and it is unsupervised, data-driven, physical-model-free and relies on as few assumptions as possible. The approach followed for membership assessment is based on an iterative process, principal component analysis, a clustering algorithm and a kernel density estimation.

### (ver 1.2, 2014-09-08, Lee Kelvin)

A variety of tools treating cosmology, FITS I/O, Sersic function modeling for galaxy images, plotting utilities, and more.

**CosmoPhotoz: Photometric redshift estimation using generalized linear models**

**(ver 0.1, 2014-08-24, Rafael de Souza)**

User-friendly interfaces to perform fast and reliable galaxy photometric redshift estimation. Accurate estimation of galaxy redshifts (distances) from broad-band photometry is essential for many problems in observational cosmology and extragalactic astronomy. The code makes use of generalized linear models and can adopt gamma or inverse gaussian families, either from a frequentist or a Bayesian perspective. The code additionally provides a `shiny' application providing a simple interactive user interface.

**astrodatR: Astronomical data**

**(ver 0.1, 2014-08-12, Eric Feigelson)**

A collection of 19 datasets from contemporary astronomical research, mostly from the textbook ‘Modern Statistical Methods for Astronomy with R Applications’ by Eric D. Feigelson and G. Jogesh Babu (Cambridge University Press, 2012, Appendix C). They cover: density estimation; heteroscedastic measurement errors; contingency tables; two-sample hypothesis tests; spatial point processes; nonlinear regression; mixture models; censoring and truncation; multivariate analysis; classification and clustering; inhomogeneous Poisson processes; periodic and stochastic time series analysis.

### astrolibR: Astronomy Users Library

**(ver. 0.3, 2014-08-09, Eric Feigelson)**

Several dozen low-level utilities and codes from the Interactive Data Language (IDL) Astronomy Users Library (http://idlastro.gsfc.nasa.gov) are implemented in R. They treat: time, coordinate and proper motion transformations; terrestrial precession and nutation, atmospheric refraction and aberration, barycentric corrections, and related effects; utilities for astrometry, photometry, and spectroscopy; and utilities for planetary, stellar, Galactic, and extragalactic science.

### CRAC: Cosmology R Analysis Code

(ver. 1.0, 2014-02-15, Jiayi Liu)

R functions for cosmological research. The main functions are similar to the python library, cosmolopy.

### moonsun: Basic astronomical calculations with R

(ver. 0.1.3, 2013-12-30, Lukasz Komsta)

A collection of basic astronomical routines for R based on "Practical astronomy with your calculator" by Peter Duffet-Smith

**magicaxis: Pretty scientific plotting with minor-tick and log minor-tick support**

**(ver 1.7, 2013-10-28, Aaron Robotham)**

**Functions to make useful (and pretty) plots for scientific plotting. Additional plotting features are added for base plotting, with particular emphasis on making attractive log axis plots.**

**sphereplot: Spherical plotting**

**(ver 1.5, 2013-10-22, Aaron Robotham)**

Various functions for creating spherical coordinate system plots via extensions to rgl.

### snapshot: Gadget N-body simulation code snapshot I/O utilities

(ver 0.1.2, 2013-10-22, Aaron Robotham)

Functions for reading and writing snapshots from videos produced by the Gadget code which is popular in astrophysics for running simulations N-body + hydrodynamical cosmological structure formation and galaxy mergers.

### FITSio: FITS (Flexible Image Transport System) utilities

(ver. 2.0-0, 2013-10-12, Andrew Harris)

Utilities to read and write files in the FITS (Flexible Image Transport System) format, a standard format in astronomy. Present low-level routines allow: * Reading, parsing and editing FITS headers * Reading FITS images (multi-dimensional arrays) * Reading FITS binary tables * Writing FITS images (multi-dimensional arrays). Higher-level functions allow: * Reading files composed of one or more headers and a single (perhaps multidimensional) image or single bintable * Reading bintables into data frames * Generating vectors for image array axes * Scaling and writing images as 16-bit integers Known incompletenesses are reading FITS ASCII table and random group extensions, as well as bit, complex, and array descriptor data types in binary tables.

### celestial: Collection of common astronomical conversion routines

### (ver 1.1, 2013-08-10, Aaron Robotham)

A small group of conversions between hour:minutes:seconds and decimal degrees.

### SCEPtER: Stellar CharactEristics Pisa Estimation gRid

**(ver. 0.1-0, Matteo Dell'Omodarme)**

A package to estimate stellar mass and radius given observational data of effective temperature, [Fe/H], and astroseismic parameters. The results are obtained adopting a maximum likelihood technique over a grid of computed stellar models.

### SCEPtERextras: Additional grids for SCEPtER

**(ver. 0.1-0, Matteo Dell'Omodarme)**

Grid of stellar models computed with various initial helium abundances and different mixing-length values.

### stellaR: stellar evolution tracks and isochrones

(ver. 0.3-3, 2013-01-21, Matteo Dell'Omodarme)

A package to manage and display stellar tracks and isochrones from Pisa low-mass database. Includes tools for isochrones construction and tracks interpolation.

### cosmoFns: Functions for cosmological distances, times, luminosities, etc

(ver. 1.0-1, 2012-12-15, Andrew Harris)

Package encapsulates standard expressions for distances, times, luminosities, and other quantities useful in observational cosmology, including molecular line observations. Currently coded for a flat universe only.

### astroFns: Astronomy: time and position functions, misc. utilities

(ver. 4.1-0, 2012-09-29, Andrew Harris)

Miscellaneous astronomy functions, utilities, and data.

### (ver. 0.1.2, 2009-10-21, Daniel Haase)

Implementation of the "Ringscale" method as proposed in the student research project "DETECTION OF FAINT COMPANIONS AROUND YOUNG STARS IN SPECKLE PATTERNS OF VLT/NACO CUBE MODE IMAGES BY MEANS OF POST-PROCESSING" at the Friedrich-Schiller-University of Jena.

**Non-CRAN R packages on GitHub**

**Non-CRAN R packages on GitHub**

### (Johannes Buchner)

This code allows likelihood functions written in R to be used by MultiNest. MultiNest treats Bayesian inference for high-dimensional parameter estimation and model selection when multimodal posteriors and computationally expensive likelihoods are present using importance nested sampling. The main program will connect to R using Rserve. It will run MultiNest, and for each point evaluation call the user-defined R callback function. It runs MultiNews written by Farhan Feroz and Mike Hobson (ver 3.4, Oct 2013). MultiNest is described by Feroz et al. (2009, 2013).

Applies a 7-8 order distortion correction to IRAC astrometric data from the Spitzer Space Telescope and includes a function for measuring apparent proper motions between different epochs.