Skip to contents

A stages table has variables in rows and stages in columns. These tables enable tracking of variables across the different stages of rebound.

Usage

stages_table(
  .analysis_data,
  include_tilde_stage = TRUE,
  add_units = TRUE,
  escape_latex = TRUE,
  vars = ReboundTools::key_analysis_vars,
  latex_vars = ReboundTools::latex_key_analysis_vars,
  stages = ReboundTools::rebound_stages,
  latex_stages = ReboundTools::latex_rebound_stages,
  case = ReboundTools::eeu_base_params$case,
  service_unit = ReboundTools::eeu_base_params$service_unit,
  energy_engr_unit = ReboundTools::eeu_base_params$energy_engr_unit,
  tilde_stage = ReboundTools::rebound_stages$tilde,
  ...,
  .var = ".var",
  .stage = ".stage",
  .var_stage = ".var_stage",
  .value = ".value",
  .name = ".name",
  .unit_col = ".unit_col"
)

Arguments

.analysis_data

A data frame, usually the result of calling rebound_analysis(). Default is rebound_analysis(load_eeu_data(file)).

include_tilde_stage

Tells whether to include the tilde column, which is identical to the bar column.

add_units

When TRUE (the default), adds a unit specification to variable names in the table.

escape_latex

When TRUE (the default), return LaTeX-compatible versions of strings.

vars

A list of variables for rows of the table. Default is ReboundTools::key_analysis_vars. Variable order is preserved in the table.

latex_vars

See ReboundTools::latex_key_analysis_vars. Set NULL to prevent conversion to LaTeX variable names.

stages

A list of stages for columns of the table. Default is ReboundTools::rebound_stages. Stage order is preserved in the table.

latex_stages

See ReboundTools::latex_rebound_stages. Set NULL to prevent conversion to LaTeX stage names.

case

See ReboundTools::eeu_base_params.

service_unit, energy_engr_unit

See ReboundTools::eeu_base_params.

tilde_stage

Used internally to identify the tilde column. Default is ReboundTools::rebound_stages$tilde.

...

Arguments passed to xtable::xtable(), possibly label, caption, digits, etc.

.var, .stage, .var_stage, .value, .name, .unit_col

Column names used internally.

Value

An xtable object suitable for printing.

Examples

load_eeu_data() %>% 
  rebound_analysis() %>% 
  stages_table()
#> % latex table generated in R 4.4.1 by xtable 1.8-4 package
#> % Tue Jul  9 20:10:29 2024
#> \begin{table}[ht]
#> \centering
#> \begin{tabular}{rllrrrrr}
#>   \hline
#>  & Case &   & Original (\$$\backslash$circ\$) & After empl (\$*\$) & After sub (\$$\backslash$wedge\$) & After inc (\$-\$) & After macro (\$$\backslash$sim\$) \\ 
#>   \hline
#> 1 & Car & \$t\_\{li$\backslash$!f$\backslash$!e\}\$ [yr] & 14.00 & 14.00 & 14.00 & 14.00 & 14.00 \\ 
#>   2 & Car & \$R\_$\backslash$alpha\$ [--] & 1.20 & 1.20 & 1.20 & 1.20 & 1.20 \\ 
#>   3 & Car & \$R\_$\backslash$omega\$ [--] & 0.80 & 0.80 & 0.80 & 0.80 & 0.80 \\ 
#>   4 & Car & \$$\backslash$eta\$ [mile/gal] & 25.00 & 42.00 & 42.00 & 42.00 & 42.00 \\ 
#>   5 & Car & \$$\backslash$eta\$ [mile/MJ] & 0.20 & 0.33 & 0.33 & 0.33 & 0.33 \\ 
#>   6 & Car & \$p\_s\$ [$\backslash$\$/mile] & 0.09 & 0.05 & 0.05 & 0.05 & 0.05 \\ 
#>   7 & Car & \$$\backslash$dot\{q\}\_s\$ [mile/yr] & 14425.00 & 14425.00 & 14749.25 & 15205.19 & 15205.19 \\ 
#>   8 & Car & \$p\_E\$ [$\backslash$\$/MJ] & 0.02 & 0.02 & 0.02 & 0.02 & 0.02 \\ 
#>   9 & Car & \$$\backslash$dot\{E\}\_s\$ [MJ/yr] & 73060.68 & 43488.50 & 44466.06 & 45840.63 & 45840.63 \\ 
#>   10 & Car & \$$\backslash$dot\{E\}\_\{emb\}\$ [MJ/yr] & 2428.57 & 2857.14 & 2857.14 & 2857.14 & 2857.14 \\ 
#>   11 & Car & \$$\backslash$dot\{C\}\_s\$ [$\backslash$\$/yr] & 1275.17 & 759.03 & 776.09 & 800.08 & 800.08 \\ 
#>   12 & Car & \$$\backslash$dot\{C\}\_\{cap\}\$ [$\backslash$\$/yr] & 2015.44 & 1965.96 & 1965.96 & 1965.96 & 1965.96 \\ 
#>   13 & Car & \$R\_\{$\backslash$alpha\}$\backslash$dot\{C\}\_\{cap\}\$ [$\backslash$\$/yr] & 2425.11 & 2365.58 & 2365.58 & 2365.58 & 2365.58 \\ 
#>   14 & Car & \$$\backslash$dot\{C\}\_\{O$\backslash$!M\}\$ [$\backslash$\$/yr] & 2861.13 & 2774.67 & 2774.67 & 2774.67 & 2774.67 \\ 
#>   15 & Car & \$C\_d\$ [$\backslash$\$] & 100.00 & 101.00 & 101.00 & 101.00 & 101.00 \\ 
#>   16 & Car & \$$\backslash$dot\{C\}\_d\$ [$\backslash$\$/yr] & 7.14 & 7.21 & 7.21 & 7.21 & 7.21 \\ 
#>   17 & Car & \$R\_\{$\backslash$omega\}$\backslash$dot\{C\}\_d\$ [$\backslash$\$/yr] & 5.68 & 5.74 & 5.74 & 5.74 & 5.74 \\ 
#>   18 & Car & \$$\backslash$dot\{C\}\_\{O$\backslash$!M$\backslash$!d\}\$ [$\backslash$\$/yr] & 2866.82 & 2780.41 & 2780.41 & 2780.41 & 2780.41 \\ 
#>   19 & Car & \$$\backslash$dot\{C\}\_o\$ [$\backslash$\$/yr] & 20834.18 & 20834.18 & 20811.86 & 21455.21 & 21455.21 \\ 
#>   20 & Car & \$$\backslash$dot\{N\}\$ [$\backslash$\$/yr] & 0.00 & 662.09 & 667.34 & 0.00 & 0.00 \\ 
#>   21 & Car & \$$\backslash$dot\{M\}\$ [$\backslash$\$/yr] & 27401.28 & 27401.28 & 27401.28 & 27401.28 & 27401.28 \\ 
#>   22 & Lamp & \$t\_\{li$\backslash$!f$\backslash$!e\}\$ [yr] & 1.80 & 10.00 & 10.00 & 10.00 & 10.00 \\ 
#>   23 & Lamp & \$R\_$\backslash$alpha\$ [--] & 1.01 & 1.14 & 1.14 & 1.14 & 1.14 \\ 
#>   24 & Lamp & \$R\_$\backslash$omega\$ [--] & 0.96 & 0.85 & 0.85 & 0.85 & 0.85 \\ 
#>   25 & Lamp & \$$\backslash$eta\$ [lm-hr/W-hr] & 8.83 & 81.80 & 81.80 & 81.80 & 81.80 \\ 
#>   26 & Lamp & \$$\backslash$eta\$ [lm-hr/MJ] & 2453.70 & 22722.22 & 22722.22 & 22722.22 & 22722.22 \\ 
#>   27 & Lamp & \$p\_s\$ [$\backslash$\$/lm-hr] & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\ 
#>   28 & Lamp & \$$\backslash$dot\{q\}\_s\$ [lm-hr/yr] & 580350.00 & 580350.00 & 1412809.74 & 1413421.03 & 1413421.03 \\ 
#>   29 & Lamp & \$p\_E\$ [$\backslash$\$/MJ] & 0.04 & 0.04 & 0.04 & 0.04 & 0.04 \\ 
#>   30 & Lamp & \$$\backslash$dot\{E\}\_s\$ [MJ/yr] & 236.52 & 25.54 & 62.18 & 62.20 & 62.20 \\ 
#>   31 & Lamp & \$$\backslash$dot\{E\}\_\{emb\}\$ [MJ/yr] & 1.22 & 0.65 & 0.65 & 0.65 & 0.65 \\ 
#>   32 & Lamp & \$$\backslash$dot\{C\}\_s\$ [$\backslash$\$/yr] & 8.90 & 0.96 & 2.34 & 2.34 & 2.34 \\ 
#>   33 & Lamp & \$$\backslash$dot\{C\}\_\{cap\}\$ [$\backslash$\$/yr] & 1.04 & 0.12 & 0.12 & 0.12 & 0.12 \\ 
#>   34 & Lamp & \$R\_\{$\backslash$alpha\}$\backslash$dot\{C\}\_\{cap\}\$ [$\backslash$\$/yr] & 1.06 & 0.14 & 0.14 & 0.14 & 0.14 \\ 
#>   35 & Lamp & \$$\backslash$dot\{C\}\_\{O$\backslash$!M\}\$ [$\backslash$\$/yr] & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\ 
#>   36 & Lamp & \$C\_d\$ [$\backslash$\$] & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\ 
#>   37 & Lamp & \$$\backslash$dot\{C\}\_d\$ [$\backslash$\$/yr] & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\ 
#>   38 & Lamp & \$R\_\{$\backslash$omega\}$\backslash$dot\{C\}\_d\$ [$\backslash$\$/yr] & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\ 
#>   39 & Lamp & \$$\backslash$dot\{C\}\_\{O$\backslash$!M$\backslash$!d\}\$ [$\backslash$\$/yr] & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\ 
#>   40 & Lamp & \$$\backslash$dot\{C\}\_o\$ [$\backslash$\$/yr] & 27391.32 & 27391.32 & 27386.95 & 27398.80 & 27398.80 \\ 
#>   41 & Lamp & \$$\backslash$dot\{N\}\$ [$\backslash$\$/yr] & 0.00 & 8.86 & 11.85 & 0.00 & 0.00 \\ 
#>   42 & Lamp & \$$\backslash$dot\{M\}\$ [$\backslash$\$/yr] & 27401.28 & 27401.28 & 27401.28 & 27401.28 & 27401.28 \\ 
#>   43 & Car, r = 0 & \$t\_\{li$\backslash$!f$\backslash$!e\}\$ [yr] & 14.00 & 14.00 & 14.00 & 14.00 & 14.00 \\ 
#>   44 & Car, r = 0 & \$R\_$\backslash$alpha\$ [--] & 1.00 & 1.00 & 1.00 & 1.00 & 1.00 \\ 
#>   45 & Car, r = 0 & \$R\_$\backslash$omega\$ [--] & 1.00 & 1.00 & 1.00 & 1.00 & 1.00 \\ 
#>   46 & Car, r = 0 & \$$\backslash$eta\$ [mile/gal] & 25.00 & 42.00 & 42.00 & 42.00 & 42.00 \\ 
#>   47 & Car, r = 0 & \$$\backslash$eta\$ [mile/MJ] & 0.20 & 0.33 & 0.33 & 0.33 & 0.33 \\ 
#>   48 & Car, r = 0 & \$p\_s\$ [$\backslash$\$/mile] & 0.09 & 0.05 & 0.05 & 0.05 & 0.05 \\ 
#>   49 & Car, r = 0 & \$$\backslash$dot\{q\}\_s\$ [mile/yr] & 14425.00 & 14425.00 & 14757.28 & 15198.33 & 15198.33 \\ 
#>   50 & Car, r = 0 & \$p\_E\$ [$\backslash$\$/MJ] & 0.02 & 0.02 & 0.02 & 0.02 & 0.02 \\ 
#>   51 & Car, r = 0 & \$$\backslash$dot\{E\}\_s\$ [MJ/yr] & 73060.68 & 43488.50 & 44490.25 & 45819.94 & 45819.94 \\ 
#>   52 & Car, r = 0 & \$$\backslash$dot\{E\}\_\{emb\}\$ [MJ/yr] & 2428.57 & 2857.14 & 2857.14 & 2857.14 & 2857.14 \\ 
#>   53 & Car, r = 0 & \$$\backslash$dot\{C\}\_s\$ [$\backslash$\$/yr] & 1275.17 & 759.03 & 776.51 & 799.72 & 799.72 \\ 
#>   54 & Car, r = 0 & \$$\backslash$dot\{C\}\_\{cap\}\$ [$\backslash$\$/yr] & 2015.44 & 1965.96 & 1965.96 & 1965.96 & 1965.96 \\ 
#>   55 & Car, r = 0 & \$R\_\{$\backslash$alpha\}$\backslash$dot\{C\}\_\{cap\}\$ [$\backslash$\$/yr] & 2015.44 & 1965.96 & 1965.96 & 1965.96 & 1965.96 \\ 
#>   56 & Car, r = 0 & \$$\backslash$dot\{C\}\_\{O$\backslash$!M\}\$ [$\backslash$\$/yr] & 2861.13 & 2774.67 & 2774.67 & 2774.67 & 2774.67 \\ 
#>   57 & Car, r = 0 & \$C\_d\$ [$\backslash$\$] & 100.00 & 101.00 & 101.00 & 101.00 & 101.00 \\ 
#>   58 & Car, r = 0 & \$$\backslash$dot\{C\}\_d\$ [$\backslash$\$/yr] & 7.14 & 7.21 & 7.21 & 7.21 & 7.21 \\ 
#>   59 & Car, r = 0 & \$R\_\{$\backslash$omega\}$\backslash$dot\{C\}\_d\$ [$\backslash$\$/yr] & 7.14 & 7.21 & 7.21 & 7.21 & 7.21 \\ 
#>   60 & Car, r = 0 & \$$\backslash$dot\{C\}\_\{O$\backslash$!M$\backslash$!d\}\$ [$\backslash$\$/yr] & 2868.28 & 2781.88 & 2781.88 & 2781.88 & 2781.88 \\ 
#>   61 & Car, r = 0 & \$$\backslash$dot\{C\}\_o\$ [$\backslash$\$/yr] & 21242.39 & 21242.39 & 21219.52 & 21853.72 & 21853.72 \\ 
#>   62 & Car, r = 0 & \$$\backslash$dot\{N\}\$ [$\backslash$\$/yr] & 0.00 & 652.01 & 657.40 & 0.00 & 0.00 \\ 
#>   63 & Car, r = 0 & \$$\backslash$dot\{M\}\$ [$\backslash$\$/yr] & 27401.28 & 27401.28 & 27401.28 & 27401.28 & 27401.28 \\ 
#>    \hline
#> \end{tabular}
#> \end{table}