export_bodies: Export body states to CSV

View source: R/save_load.R

export_bodiesR Documentation

Export body states to CSV

Description

Writes the body table (id, mass, position, and velocity) from an 'orbit_system' to a CSV file. This is useful for sharing initial conditions with collaborators or loading them into other tools like Python or Excel.

Usage

export_bodies(system, path)

Arguments

system

An 'orbit_system' object.

path

File path to save to. Should end in '.csv'.

Value

'system', invisibly.

Examples


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

export_bodies(sys, file.path(tempdir(), "bodies.csv"))


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