get_bodies: Extract the body table from a system

View source: R/get_bodies.R

get_bodiesR Documentation

Extract the body table from a system

Description

Returns the bodies in an 'orbit_system' as a standalone tibble. Useful when you want to inspect, filter, or save the body states without dealing with the full system object.

Usage

get_bodies(system)

Arguments

system

An 'orbit_system' object.

Value

A tibble with columns 'id', 'mass', 'x', 'y', 'z', 'vx', 'vy', 'vz'.

Examples

sys <- create_system() |>
  add_sun() |>
  add_planet("Earth", parent = "Sun") |>
  add_planet("Mars",  parent = "Sun")

# Get the tibble
get_bodies(sys)

# Use with dplyr

get_bodies(sys) |>
  dplyr::filter(mass > 1e24)


orbitr documentation built on Oct. 2, 2026, 1:06 a.m.