Skip to contents

Fetch Exoplanets table

Usage

fetch_table(
  table,
  query_string = NULL,
  pretty_colnames = FALSE,
  format = "csv"
)

Arguments

table

A string specifying the table to query. Must be one of:

  • ps - Planetary Systems table

  • pscomppars – Planetary Systems Composite Parameters table

  • stellarhosts – Stellar Hosts table

  • keplernames – Kepler Confirmed Names

query_string

Optional ADQL WHERE clause as a string, e.g., pl_bmasse > 1 AND st_teff < 6000.

pretty_colnames

Optional bool value. If TRUE replaces database column names with their labels / descriptions. Defaults to FALSE. Currently only tables ps and pscomppars are supported.

format

Optional char value specifying output format. Can be either "csv" for data frame, or "json" for a named list.

Value

A data frame or named list containing fetched data.

Details

Fetches data from an exoplanets TAP (Table Access Protocol) service and returns it as a data frame or a named list. You can optionally specify WHERE ADQL clause to filter rows based on conditions.

Examples

# \donttest{
 # All entries from Stellar Hosts table
 fetch_table("stellarhosts")
#> INFO [2025-09-08 21:41:50] Fetching table `stellarhosts`...
#> SUCCESS [2025-09-08 21:42:07] Table stellarhosts fetched successfully.
#> # A tibble: 46,609 × 135
#>    hostname    hd_name hip_name tic_id   st_refname sy_refname    ra rastr   dec
#>    <chr>       <chr>   <chr>    <chr>    <chr>      <chr>      <dbl> <chr> <dbl>
#>  1 Kepler-27   NA      NA       TIC 137… <a refstr… <a refstr…  292. 19h2…  41.1
#>  2 Kepler-633  NA      NA       TIC 138… <a refstr… <a refstr…  295. 19h4…  40.6
#>  3 Kepler-1063 NA      NA       TIC 122… <a refstr… <a refstr…  291. 19h2…  38.1
#>  4 Kepler-1945 NA      NA       TIC 123… <a refstr… <a refstr…  282. 18h4…  42.3
#>  5 Kepler-1006 NA      NA       TIC 271… <a refstr… <a refstr…  296. 19h4…  42.5
#>  6 Kepler-799  NA      NA       TIC 158… <a refstr… <a refstr…  287. 19h0…  44.9
#>  7 Kepler-636  NA      NA       TIC 138… <a refstr… <a refstr…  294. 19h3…  41.1
#>  8 Kepler-477  NA      NA       TIC 158… <a refstr… <a refstr…  288. 19h1…  42.4
#>  9 Kepler-565  NA      NA       TIC 164… <a refstr… <a refstr…  284. 18h5…  47.2
#> 10 Kepler-27   NA      NA       TIC 137… <a refstr… <a refstr…  292. 19h2…  41.1
#> # ℹ 46,599 more rows
#> # ℹ 126 more variables: decstr <chr>, glon <dbl>, glat <dbl>, elon <dbl>,
#> #   elat <dbl>, sy_icmag <lgl>, sy_icmagerr1 <lgl>, sy_icmagerr2 <lgl>,
#> #   st_teff <dbl>, st_tefferr1 <dbl>, st_tefferr2 <dbl>, st_tefflim <dbl>,
#> #   st_met <dbl>, st_meterr1 <dbl>, st_meterr2 <dbl>, st_metlim <dbl>,
#> #   st_radv <dbl>, st_radverr1 <dbl>, st_radverr2 <dbl>, st_radvlim <dbl>,
#> #   st_vsin <dbl>, st_vsinerr1 <dbl>, st_vsinerr2 <dbl>, st_vsinlim <dbl>, …
 # Entries from Planetary Systems table where planetary mass > 3 times the earth mass
 fetch_table("ps", query_string = "pl_bmasse > 3")
#> INFO [2025-09-08 21:42:07] Fetching table `ps`...
#> SUCCESS [2025-09-08 21:42:14] Table ps fetched successfully.
#> # A tibble: 6,384 × 354
#>    pl_name     pl_letter hostname  hd_name hip_name tic_id  gaia_id default_flag
#>    <chr>       <chr>     <chr>     <chr>   <chr>    <chr>   <chr>          <dbl>
#>  1 Kepler-6 b  b         Kepler-6  NA      NA       TIC 27… Gaia D…            0
#>  2 Kepler-6 b  b         Kepler-6  NA      NA       TIC 27… Gaia D…            1
#>  3 Kepler-6 b  b         Kepler-6  NA      NA       TIC 27… Gaia D…            0
#>  4 Kepler-6 b  b         Kepler-6  NA      NA       TIC 27… Gaia D…            0
#>  5 Kepler-32 c c         Kepler-32 NA      NA       TIC 27… Gaia D…            1
#>  6 Kepler-32 c c         Kepler-32 NA      NA       TIC 27… Gaia D…            0
#>  7 Kepler-29 c c         Kepler-29 NA      NA       TIC 27… Gaia D…            0
#>  8 Kepler-29 c c         Kepler-29 NA      NA       TIC 27… Gaia D…            0
#>  9 Kepler-29 c c         Kepler-29 NA      NA       TIC 27… Gaia D…            1
#> 10 Kepler-20 c c         Kepler-20 NA      NA       TIC 15… Gaia D…            1
#> # ℹ 6,374 more rows
#> # ℹ 346 more variables: pl_refname <chr>, sy_refname <chr>, disc_pubdate <chr>,
#> #   disc_year <dbl>, discoverymethod <chr>, disc_locale <chr>,
#> #   disc_facility <chr>, disc_instrument <chr>, disc_telescope <chr>,
#> #   disc_refname <chr>, ra <dbl>, rastr <chr>, dec <dbl>, decstr <chr>,
#> #   glon <dbl>, glat <dbl>, elon <dbl>, elat <dbl>, pl_orbper <dbl>,
#> #   pl_orbpererr1 <dbl>, pl_orbpererr2 <dbl>, pl_orbperlim <dbl>, …
 # Planets orbiting Teegarden's Star with radius > 1 Earth radius
 fetch_table("pscomppars", query_string = "hostname = 'Teegarden''s Star' and pl_rade > 1")
#> INFO [2025-09-08 21:42:14] Fetching table `pscomppars`...
#> SUCCESS [2025-09-08 21:42:15] Table pscomppars fetched successfully.
#> # A tibble: 2 × 682
#>   objectid pl_name            pl_letter hostid hostname  hd_name hip_name tic_id
#>      <dbl> <chr>              <chr>      <dbl> <chr>     <lgl>   <lgl>    <chr> 
#> 1     3.12 Teegarden's Star b b           2.10 Teegarde… NA      NA       TIC 2…
#> 2     3.12 Teegarden's Star c c           2.10 Teegarde… NA      NA       TIC 2…
#> # ℹ 674 more variables: disc_pubdate <chr>, disc_year <dbl>, disc_method <chr>,
#> #   discoverymethod <chr>, disc_locale <chr>, disc_facility <chr>,
#> #   disc_instrument <chr>, disc_telescope <chr>, disc_refname <chr>, ra <dbl>,
#> #   raerr1 <dbl>, raerr2 <dbl>, rasymerr <dbl>, rastr <chr>, ra_solnid <dbl>,
#> #   ra_reflink <chr>, dec <dbl>, decerr1 <dbl>, decerr2 <dbl>, decsymerr <dbl>,
#> #   decstr <chr>, dec_solnid <dbl>, dec_reflink <chr>, glon <dbl>,
#> #   glonerr1 <lgl>, glonerr2 <lgl>, glonsymerr <lgl>, glonstr <dbl>, …
# }