knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

exoplanets

R build status Codecov test coverage Peer review CRAN status CRAN_Download_Badge

The goal of exoplanets is to provide access to NASA's Exoplanet Archive TAP Service. The functionality of this package is minimal and is simply an R interface to access exoplanet data.

# library(ggplot2)
# library(tidyr)
# library(dplyr)
# library(RColorBrewer)
# 
# exoplanets <- exo::exo() %>% 
#   as_tibble()
# 
# ggexoplanets <- exoplanets %>% 
#   select(pl_bmassj, pl_orbper, pl_discmethod) %>% 
#   drop_na() 
# 
# # cols_vec <- randomcoloR::distinctColorPalette(length(unique(ggexoplanets$pl_discmethod)))
# 
# exoplanets <- exo::exo() %>% 
#   as_tibble()
# 
# cols_vec <- c("#86E57B", "#77AFD7", "#DCD955", "#CFD49C", "#D5CCD1", "#84DECA", "#E15AB9", "#D4816C", "#BA91D1", "#A152DF")
# 
# exoplanets %>% 
#   select(pl_name, pl_bmassj, pl_orbper, pl_discmethod) %>% 
#   drop_na(pl_bmassj, pl_orbper, pl_discmethod) %>% 
#   arrange(pl_name) %>% 
#   ggplot(aes(pl_orbper, pl_bmassj)) +
#   geom_point(aes(fill = pl_discmethod), color = "black", shape = 21, size = 2) +
#   scale_x_log10(
#     breaks = scales::trans_breaks("log10", function(x) 10^x),
#     labels = scales::trans_format("log10", scales::math_format(10^.x))
#   ) +
#   scale_y_log10(
#     breaks = scales::trans_breaks("log10", function(x) 10^x),
#     labels = scales::trans_format("log10", scales::math_format(10^.x))
#   ) +
#   labs(
#     x = "Period (days)",
#     y = "Mass (Jupiter Masses)",
#     fill = "Discovery Method"
#   ) +
#   annotation_logticks() +
#   scale_fill_manual(values = cols_vec) +
#   guides(fill = guide_legend(override.aes = list(size = 4))) +
#   geom_curve(aes(x = 100, y = 0.00070, xend = 6.0996151 + 0.6, yend = 0.00194 - 0.0002), 
#              colour = "#555555", 
#              size = 0.5, 
#              curvature = -0.2,
#              arrow = arrow(length = unit(0.03, "npc"))) + 
#   geom_label(aes(x = 100, y = 0.00070, label = "TRAPPIST-1 e"), 
#              hjust = 0, 
#              vjust = 0.5, 
#              label.size = NA, 
#              family = "SFProText-Regular", 
#              size = 5) +
#   theme_bw() +
#   theme(
#     text = element_text(family = "SFProText-Regular"),
#     plot.caption = element_text(family = "SFProText-RegularItalic"),
#     panel.grid = element_blank()
#   )

knitr::include_graphics("man/figures/README-unnamed-chunk-2-1.png")

Installation

Install the released version of exoplanets from CRAN:

install.packages("exoplanets")

Or you can install from GitHub with:

# install.packages("devtools")
devtools::install_github("ropensci/exoplanets")

Example

This is a basic example which shows you how to access data from the k2names table:

library(exoplanets)

options(
  exoplanets.progress = FALSE, # hide progress
  readr.show_types = FALSE     # hide col spec, requires readr 2.0.0 >=
)

exoplanets("k2names")

If you wish, you can select only the columns you need:

exoplanets("ps", c("pl_name", "hostname"))

You can also specify the number of rows returned using limit:

exoplanets("keplernames", limit = 5)

Information on the tables and columns available can be found with:

tableinfo

Capabilities

At one time, this package used the Exoplanet Archive Application Programming Interface (API). Since then, a handful of tables have been transitioned to the Table Access Protocol (TAP) service. More tables will be transitioned to TAP and as such, this package only supports queries from TAP. For more information, you can read https://exoplanetarchive.ipac.caltech.edu/docs/exonews_archive.html#29April2021.

Contributing

Please note that this package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.



ropensci/exoplanets documentation built on Sept. 24, 2022, 6:19 p.m.