remove_body: Remove one or more bodies from the system

View source: R/remove_body.R

remove_bodyR Documentation

Remove one or more bodies from the system

Description

Drops bodies by name from an 'orbit_system'. This is the counterpart to [add_body()] — use it to strip out bodies you no longer need before simulating, or to prune a system built with [load_solar_system()].

Usage

remove_body(system, id)

Arguments

system

An 'orbit_system' object.

id

A character vector of body names to remove. All names must exist in the system.

Details

“' load_solar_system() |> remove_body(c("Pluto", "Moon")) |> simulate_system(time_step = seconds_per_day, duration = seconds_per_year) “'

Value

The updated 'orbit_system' with the specified bodies removed.

Examples

# Remove a single body
create_system() |>
  add_sun() |>
  add_planet("Earth", parent = "Sun") |>
  add_planet("Mars",  parent = "Sun") |>
  remove_body("Mars")


# Remove multiple bodies from the full solar system
load_solar_system() |>
  remove_body(c("Pluto", "Moon")) |>
  simulate_system(time_step = seconds_per_day, duration = seconds_per_year) |>
  plot_orbits()


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