knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
# devtools::install_github("Liu-Zhichao/nasaR") library(nasaR)
The followings show the usage and examples of all functions (sorted alphabetically) included in the package. For detailed meaning of each parameter, please check the helper file of each funtion by running "?[function name]" in the console.
Tips: All examples are valid only when you place NASA token in R.evironment and name it "NASA_TOKEN" (by default), otherwise you need check the helper file carefully and enter your private key in the function every time.
The function helps print out an stronomy picture of the day. Each day a different image or photograph of our fascinating universe is featured, along with a brief explanation written by a professional astronomer.
APOD <- function(key = Sys.getenv("NASA_TOKEN"), date = Sys.Date(), hd = FALSE, return_text = FALSE, download_filename = "img.jpg")
APOD() APOD(date = as.Date("2019-11-01"), hd = TRUE, return_text = TRUE)
This function provides access to current close-approach data for all asteroids and comets in JPL’s SBDB (Small-Body DataBase). See detailed info at: https://ssd-api.jpl.nasa.gov/doc/cad.html.
CAD <- function(date_min = "now", date_max = lubridate::today() + 60, dist_min = NULL, dist_max = "0.05", h_min = NULL, h_max = NULL, v_inf_min = NULL, v_inf_max = NULL, v_rel_min = NULL, v_rel_max = NULL, class = NULL, pha = FALSE, nea = FALSE, comet = FALSE, nea_comet = FALSE, neo = TRUE, kind = NULL, spk = NULL, des = NULL, body = "Earth", sort = "date", limit = NULL, fullname = FALSE)
CAD(des = "433", date_min = as.Date("2019-01-01"), date_max = as.Date("2100-01-01"), dist_max = "0.2") CAD(dist_max = "10LD", date_min = as.Date("2018-01-01"), sort = "dist")
This function provides access to the data of Coronal Mass Ejection (CME).
DONKI_CME <- function(key = Sys.getenv("NASA_TOKEN"), start_date = end_date - 30, end_date = lubridate::today(tzone = "UTC"))
DONKI_CME(end_date = as.Date("2019-11-20"))
This function provides access to the data of Coronal Mass Ejection (CME) Analysis.
DONKI_CME_Analysis <- function(key = Sys.getenv("NASA_TOKEN"), start_date = end_date - 30, end_date = lubridate::today(tzone = "UTC"), mostAccurateOnly = TRUE, completeEntryOnly = TRUE, speed = 0, halfAngle = 0, catalog = "ALL", keyword = "NONE")
DONKI_CME_Analysis(start_date = as.Date("2016-09-01"), end_date = as.Date("2016-09-30"), speed = 500, halfAngle = 30)
This function provides access to the data of Solar Flare (FLR).
DONKI_FLR <- function(key = Sys.getenv("NASA_TOKEN"), start_date = end_date - 30, end_date = lubridate::today(tzone = "UTC"))
DONKI_FLR(start_date = as.Date("2019-01-01"), end_date = as.Date("2019-06-30"))
This function provides access to the data of Geomagnetic Storm (GST).
DONKI_GST <- function(key = Sys.getenv("NASA_TOKEN"), start_date = end_date - 30, end_date = lubridate::today(tzone = "UTC")){
DONKI_GST(start_date = as.Date("2015-01-01"), end_date = as.Date("2015-06-30"))
This function provides access to the data of Hight Speed Stream (HSS).
DONKI_HSS <- function(key = Sys.getenv("NASA_TOKEN"), start_date = end_date - 30, end_date = lubridate::today(tzone = "UTC"))
DONKI_HSS(start_date = as.Date("2019-01-01"))
This function provides access to the data of Interplanetary Shock (IPS).
DONKI_IPS <- function(key = Sys.getenv("NASA_TOKEN"), start_date = end_date - 30, end_date = lubridate::today(tzone = "UTC"), location = "ALL", catalog = "ALL")
DONKI_IPS(start_date = as.Date("2019-01-01"), end_date = as.Date("2019-10-31"), location = "Earth")
This function provides access to the data of Magnetopause Crossing (MPC).
DONKI_MPC <- function(key = Sys.getenv("NASA_TOKEN"), start_date = end_date - 30, end_date = lubridate::today(tzone = "UTC"))
DONKI_MPC(start_date = as.Date("2018-01-01"))
This function provides access to the data of Notifications.
DONKI_Notifications <- function(key = Sys.getenv("NASA_TOKEN"), start_date = end_date - 7, end_date = lubridate::today(tzone = "UTC"), type = "all")
DONKI_Notifications(start_date = as.Date("2019-01-01"), end_date = as.Date("2019-03-01"))
This function provides access to the data of Radiation Belt Enhancement (RBE).
DONKI_RBE <- function(key = Sys.getenv("NASA_TOKEN"), start_date = end_date - 30, end_date = lubridate::today(tzone = "UTC"))
DONKI_RBE(start_date = as.Date("2019-01-01"))
This function provides access to the data of Solar Energetic Particle (SEP).
DONKI_SEP <- function(key = Sys.getenv("NASA_TOKEN"), start_date = end_date - 30, end_date = lubridate::today(tzone = "UTC"))
DONKI_SEP(start_date = as.Date("2000-01-01"), end_date = as.Date("2010-12-31"))
This function provides access to the data of WSA+EnlilSimulation.
DONKI_WSAEnlilSimulation <- function(key = Sys.getenv("NASA_TOKEN"), start_date = end_date - 7, end_date = lubridate::today(tzone = "UTC"))
DONKI_WSAEnlilSimulation(start_date = as.Date("2019-10-01"), end_date = as.Date("2019-10-15"))
This function retrieves retrieves the date-times and asset names for available imagery for a supplied location.
Earth_Assets <- function(key = Sys.getenv("NASA_TOKEN"), lat, lon, begin_date, end_date = Sys.Date())
Earth_Assets(lon = 100.75, lat = 1.5, begin_date = as.Date("2014-02-01"))
This function retrieves the Landsat 8 image for the supplied location and date.
Earth_Imagery <- function(key = Sys.getenv("NASA_TOKEN"), lat, lon, dim = 0.025, date = Sys.Date(), cloud_score = FALSE, download_filename = "img.png")
Earth_Imagery(lon = 100.75, lat = 1.5, date = as.Date("2014-02-01"), cloud_score = TRUE)
This function helps get access to the information of events on the Earth (filtered by events/categories/layers).
EONET_Events <- function(source = c("InciWeb", "EO"), status = "open", limit = 5, days = 20, by_events = TRUE, by_layers = FALSE, category_id = 8)
#### Filtered by events: EONET_Events(source = "InciWeb", limit = 10, days = 30) #### Filtered by categories: EONET_Events(category_id = 8, source = "EO", limit = 5, days = 365, by_events = FALSE) #### Filtered by layers: EONET_Events(by_layers = TRUE, category_id = 14)
This function helps provide information on the daily imagery collected by DSCOVR's Earth Polychromatic Imaging Camera (EPIC) instrument.
EPIC <- function(key = Sys.getenv("NASA_TOKEN"), query_by_date, date = Sys.Date(), download = FALSE)
EPIC(query_by_date = "natural") EPIC(query_by_date = "enhanced/date", date = as.Date("2019-11-01")) EPIC(query_by_date = "natural/date", date = as.Date("2019-06-01"), download = TRUE)
This function allows programatic access to NASA's Exoplanet Archive database. See detailed info at: https://exoplanetarchive.ipac.caltech.edu/docs/program_interfaces.html#data.
Exoplanet <- function(table = "exoplanets", select = NULL, count = NULL, colset = NULL, where = NULL, order = NULL, ra = NULL, dec = NULL, radius = NULL, aliastable = NULL)
Exoplanet() Exoplanet(select = "pl_hostname", order = "dec") Exoplanet(ra = 291, dec = 48, radius = "1 degree") Exoplanet(table = "cumulative", where = c("koi_prad<2", "koi_teq>180", "koi_teq<303", "koi_disposition like 'CANDIDATE'")) Exoplanet(aliastable = "bet Pic")
This function helps provide a method of requesting specific records from the available data-set. Every successful query will return content representing one or more fireball data records. See detailed info at: https://ssd-api.jpl.nasa.gov/doc/fireball.html.
Fireball <- function(date_min = lubridate::today(), date_max = lubridate::today() + 60, energy_min = NULL, energy_max = NULL, impact_e_min = NULL, impact_e_max = NULL, vel_min = NULL, vel_max = NULL, alt_min = NULL, alt_max = NULL, req_loc = FALSE, req_alt = FALSE, req_vel = FALSE, req_vel_comp = FALSE, vel_comp = FALSE, sort = "date", limit = NULL)
Fireball(date_min = as.Date("2014-01-01"), limit = 20) Fireball(date_min = as.Date("2015-01-01"), req_alt = TRUE, sort = "-date")
This function helps get access to the data from GeneLab website.
GeneLab_Search <- function(key = Sys.getenv("NASA_TOKEN"), term = "", type = "cgene", from = 0, size = 25, order = "DESC", ffield, fvalue)
GeneLab_Search(term = "space", ffield = "links", fvalue = "GPL16417", type = "cgene,nih_geo_gse") GeneLab_Search(ffield = "Accession", fvalue = "GSE82255")
This function helps provide per-Sol summary data for each of the last seven available Sols (Martian Days).
Insight <- function(key = Sys.getenv("NASA_TOKEN"), ver = "1.0", feedtype = "json", simplified_data_frame = FALSE)
Insight() Insight(simplified_data_frame = TRUE)
This function helps get access to the JPL/SSD small-body mission design suite. See detailed info at: https://ssd-api.jpl.nasa.gov/doc/mdesign.html.
Mission_Design <- function(mode = "Q", des = NULL, spk = NULL, sstr = NULL, class = FALSE, mjd0 = NULL, span = NULL, tof_min = NULL, tof_max = NULL, step = NULL)
#### Mode: Q Mission_Design(des = "2012%20TC4") Mission_Design(des = 1, class = TRUE) Mission_Design(sstr = "apophis") #### Mode: M Mission_Design(mode = "M", des = "2012%20TC4", mjd0 = 58490, span = 3652, tof_min = 10, tof_max = 365, step = 2)
This function helps get access to Mars Rover Photos - Querying by Earth date.
MRP_date <- function(key = Sys.getenv("NASA_TOKEN"), earth_date, camera = "all", page = 1, type = "curiosity", download_image = FALSE)
MRP_date(earth_date = "2015-06-03") MRP_date(earth_date = "2019-05-01", download_image = TRUE)
This function helps get access to Mars Rover Photos - Querying by Martian sol.
MRP_sol <- function(key = Sys.getenv("NASA_TOKEN"), sol = 1000, camera = "all", page = 1, type = "curiosity", download_image = FALSE)
MRP_sol(download_image = TRUE) MRP_sol(camera = "MAST", page = 2) MRP_sol(type = "opportunity")
This function helps get access to Info of images/videos in NASA Image and Video Library.
NASA_Image_Video <- function(endpoint, nasa_id = NULL, q = NULL, center = NULL, description = NULL, description_508 = NULL, keywords = NULL, location = NULL, media_type = NULL, page = NULL, photographer = NULL, secondary_creator = NULL, title = NULL, year_start = NULL, year_end = NULL)
NASA_Image_Video(endpoint = "search", q = "apollo%2011", description = "moon%20landing", media_type = "image") NASA_Image_Video(endpoint = "asset", nasa_id = "as11-40-5874") NASA_Image_Video(endpoint = "metadata", nasa_id = "as11-40-5874") NASA_Image_Video(endpoint = "captions", nasa_id = "172_ISS-Slosh")
This function helps browse the overall Asteroid dataset.
Neo_Browse <- function(key = Sys.getenv("NASA_TOKEN"))
Neo_Browse()
This function retrieves a list of Asteroids based on their closest approach date to Earth.
Neo_Feed <- function(key = Sys.getenv("NASA_TOKEN"), start_date, end_date = start_date + 7, as_dataframe = FALSE)
Neo_Feed(start_date = as.Date("2019-11-01"), end_date = as.Date("2019-11-03"), as_dataframe = TRUE)
This function helps lookup a specific Asteroid based on its NASA JPL small body (SPK-ID) ID.
Neo_Lookup <- function(key = Sys.getenv("NASA_TOKEN"), asteroid_id)
Neo_Lookup(asteroid_id = 3542519)
This function provides a method of requesting data from the NHATS-related tables in the SBDB. See detailed info at: https://ssd-api.jpl.nasa.gov/doc/nhats.html.
NHATS <- function(mode = "S", dv = 12, dur = 450, stay = 8, launch = "2020-2045", h = NULL, occ = NULL, spk = NULL, des = NULL, plot = FALSE)
#### Mode: S NHATS(dv = 6, dur = 360, stay = 8, launch = "2020-2045", h = 26, occ = 7) #### Mode: O NHATS(mode = "O", des = "99942") NHATS(mode = "O", des = "2000%20SG344", dv = 6, dur = 360, stay = 8, launch = "2020-2045")
This function helps get access to the data of NASA's patents.
Patents <- function(key = Sys.getenv("NASA_TOKEN"), query, concept_tags = FALSE, limit = 5)
Patents(query = "temperature")
This function provides access to near-realtime results from the CNEOS Scout system. See detailed info at: https://ssd-api.jpl.nasa.gov/doc/scout.html.
Scout <- function(mode = "O", tdes = NULL, plot = NULL, file = NULL, orbits = FALSE, n_orbits = 1000, eph_start = "now", eph_stop = NULL, eph_step = NULL, obs_code = "500", fov_diam = NULL, fov_ra = NULL, fov_dec = NULL, fov_vmag = NULL)
## Note that the NEOCP object tdes used in the following examples is not guaranteed to still exist in the database. #### Mode: O Scout(tdes = "P10vY9r") Scout(tdes = "P10vY9r", plot = "el") Scout(tdes = "P10vY9r", orbits = 1) #### Mode: E Scout(mode = "E", tdes = "P10vY9r", eph_start = "2016-09-24T12:00:00") Scout(mode = "E", tdes = "P10vY9r", eph_start = "2016-09-25T18:00:00", eph_stop = "2016-09-26T06:00:00", eph_step = "2h")
This function provides access to results from the CNEOS Sentry system. See detailed info at: https://ssd-api.jpl.nasa.gov/doc/sentry.html.
Sentry <- function(mode = "S", spk = NULL, des = NULL, h_max = NULL, ps_min = NULL, ip_min = NULL, days = NULL, all = FALSE, removed = FALSE)
#### Mode: O Sentry(mode = "O", des = "99942") Sentry(mode = "O", des = "2000%20SG344") #### Mode: S Sentry() #### Mode: V Sentry(mode = "V", all = TRUE, ip_min = 1e-3) #### Mode: R Sentry(mode = "R", removed = TRUE)
This function helps discover the technologies NASA is working on every day to explore space, understand the universe, and improve aeronautics.
Techport <- function(key = Sys.getenv("NASA_TOKEN"), id_parameter = NULL, all_valid_id = FALSE, update_since = NULL)
Techport(id_parameter = 17792) Techport(all_valid_id = TRUE) Techport(update_since = as.Date("2016-01-01"))
This function helps get access to the data of earth-orbiting objects
TLE <- function(satellite_name = NULL, satellite_num = NULL)
TLE(satellite_name = "HTV") TLE(satellite_num = 43553)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.