ADFI get from pig performance test station csv data

adfi_get(data, adg_res)

Arguments

data

A data frame or data table containing the nedap or fire pig performance test data to be processed. Columns must include 'visit_time', 'location', 'responder', 'feed_intake'.

adg_res

ADG results from function of adg_get().

Value

A list containing:

  • dfi_info: A data.table containing DFI statistics

  • dfi_data: A data.table containing processed sample data

Examples

nedap_csv_data <- mintyr::nedap
adg_results <- adg_get(data = nedap_csv_data)
#> • There are no duplicate responders in different locations.
#> • The removing of weight < 15kg will not delete responder.
#> • Removing records of missing will delete responders: 1
#> • Deleted responders: 
#>  c("15964")
#> • Running RANSAC Robust Regression:
#> • RANSAC Robust Regression succeeded!
#> • The outliers detected by Robust model will not delete responder.
#> • All responders' begin_test_weight are less than or equal to 60kg.
#> • Removing end_test_weight <85kg records will delete responders: 1
#> • Deleted responders: 
#>  c("15967")
#> • Running Simple Linear Regression
#> • Calculate ADG using Simple Linear Regression succeeded!
adfi_results <- adfi_get(data = nedap_csv_data, adg_res = adg_results)
#> • There are no duplicate responders in different locations.
#> • Successfully generated the following 3 variables:
#>  - FIV:feed intake per visit;
#>  - OTV:occupation time per visit;
#>  - FRV:feeding rate per visit;
#> • Successfully generated 10 error types from 3 variables:
#>  - FIV-lo; FIV-hi; FIV-0; OTV-lo; OTV-hi; FRV-hi-FIV-lo; FRV-hi-strict; FRV-hi; FRV-0; FRV-lo;
#> • Running linear mixed model with equation: 
#>  dfi_right_part ~ otd_2 + otd_6 + otd_9 + otd_10 + otv_hi_p + frv_hi_fiv_lo_p + frv_lo_p + location + lm_slope + weight + (1 | responder)
head(adfi_results$adfi_info)
#> Key: <responder, location>
#>    responder location test_days origin_dfi corrected_dfi
#>       <char>   <char>     <int>      <num>         <num>
#> 1:     13913      101        95   2562.365      2577.739
#> 2:     13918      101        96   2319.814      2305.710
#> 3:     13935      102        96   2703.371      2706.317
#> 4:     13954      101        95   2317.260      2308.288
#> 5:     13996      101        96   2909.309      2921.329
#> 6:     14260      102        96   2846.546      2819.889