Run prep_visits(), clean_weight(), calc_adg(), calc_adfi() and calc_fcr() in a row with the same QC settings.

run_pipeline(
  data,
  station = NULL,
  qc = qc_config(),
  breeds = NULL,
  verbose = 1,
  cores = 1
)

Arguments

data

Raw station data (see prep_visits()).

station

"nedap", "fire" or NULL to detect it.

qc

QC settings from qc_config().

breeds

Optional breed table passed to add_breed() (columns responder and breed).

verbose

0 (silent), 1 (summary, default) or 2 (details).

cores

Number of CPU cores for the per-pig computations. Default 1.

Value

An object of class ppt_pipeline: a list with visits, weight, adg, adfi and fcr, plus removed (every pig removed, with the step and the reason). Printing it shows a summary box. With verbose >= 1 the steps are numbered with their run time, the box is shown at the end and the result is returned invisibly.

Examples

res <- run_pipeline(fire, qc = qc_config(stage_range = c(60, 120)), verbose = 0)
res
#> ╭  Results FIRE  ───────────────────────────────────────────────────────────╮
#> │ Pigs   26 in the data · 25 with FCR (21 ok, 4 low confidence) · 1 removed │
#> │ ADG    1207 ± 106 g/d                                                     │
#> │ ADFI   3249 ± 250 g/d                                                     │
#> │ FCR    2.70 ± 0.16                                                        │
#> │                                                                           │
#> │ Check                                                                     │
#> │   25822 (101): weight records cover 5.1 kg of 70-80 kg                    │
#> │   35858 (102): weight records cover 4.4 kg of 100-110 kg                  │
#> │   35892 (102): weight data flagged                                        │
#> │   35897 (102): weight data flagged                                        │
#> │   35888 (101): removed, test period 9 d < 35 d                            │
#> │                                                                           │
#> │ Next: plot_adg(), plot_adfi(), write_report(), write_results()            │
#> ╰───────────────────────────────────────────────────────────────────────────╯
res$fcr$summary[group == "all"]
#>     group        trait     n          min          max       median
#>    <char>       <char> <int>        <num>        <num>        <num>
#> 1:    all          adg    25  939.7806629 1455.9297415 1205.5702281
#> 2:    all         adfi    25 2591.1968792 3875.9180223 3220.8402264
#> 3:    all          fcr    25    2.3545315    3.0172000    2.6729084
#> 4:    all           gf    25    0.3314331    0.4247129    0.3741243
#> 5:    all   stage_days    25   40.4287257   63.3513721   48.9403502
#> 6:    all start_weight    25   59.9999805   60.0000044   59.9999959
#> 7:    all   end_weight    25  119.9999801  120.0000042  119.9999944
#>            mean           sd           cv
#>           <num>        <num>        <num>
#> 1: 1207.2469699 1.058301e+02 8.766236e-02
#> 2: 3249.3079139 2.503801e+02 7.705644e-02
#> 3:    2.6982479 1.577920e-01 5.847943e-02
#> 4:    0.3718191 2.159314e-02 5.807431e-02
#> 5:   49.6475333 4.745273e+00 9.557922e-02
#> 6:   59.9999954 5.704224e-06 9.507041e-08
#> 7:  119.9999944 4.646078e-06 3.871732e-08