fid_monitor

You can use fid_monitor() to monitor the feed intake of each pig in the nedap or fire pig performance test station as well as the total feed intake of all pigs.

# Load CSV data
data <- data.table::fread("C:/Users/Dell/Documents/projects/pptsdm_data/ppt_monitor_test_data.csv")
# Feed intake monitor
fid_monitor(data = data, station_type = "nedap", save_path = "C:/Users/Dell/Downloads/test")

station_monitor

You can use function of station_monitor() to monitor pig performance test data from nedap and fire pig performance test stations. This function can monitor the changes in the number of pigs, total visitation time of pigs, total number of visits, changes in total feed intake, and also monitor the changes in pig weights for a specific pig performance test station.

# Load CSV data
data <- data.table::fread("C:/Users/Dell/Documents/projects/pptsdm_data/ppt_monitor_test_data.csv")
# Station monitor
station_monitor(data = data, station_type = "nedap", save_path = "C:/Users/Dell/Downloads/test")

table_monitor

table_monitor serves as a complement to two other monitoring functions. It primarily aims to analyze and monitor, based on the CSV data from the past n days of measurement stations, the daily counts of missing records, extreme weight recordings, total feeding time at each measurement station, total feeding amount per pen per day, average weight per pen per day, and feed intake information in each hour.

# Load CSV data
data <- data.table::fread("C:/Users/Dell/Documents/projects/pptsdm_data/ppt_monitor_test_data.csv")
# Monitor station and data
res <- table_monitor(data = data, days = 5, save_path = "C:/Users/Dell/Downloads/test")
# Monitor the number of times 'na' appears in the last n days
head(res$responder_na)
#>    location 06-03 06-04 06-05 06-06 06-07 total_nas
#>      <char> <int> <int> <int> <int> <int>     <num>
#> 1:      501     0     0     0     0     0         0
#> 2:      502     2     1     1     3     2         9
#> 3:      503     0     2     2     0     0         4
#> 4:      504     2     0     2     0     0         4
#> 5:      505     0     0     0     0     0         0
#> 6:      506     0     0     0     0     0         0
# Monitor the percentage of extreme weight records in the last n days
head(res$extreme_weight)
#> Key: <location>
#>    location 06-03 06-04 06-05 06-06 06-07
#>       <int> <num> <num> <num> <num> <num>
#> 1:      501  7.07  4.31  4.12  2.78  5.79
#> 2:      502  5.38  6.86  3.12  6.67  7.32
#> 3:      503  4.82  5.32  6.17  5.19  5.21
#> 4:      504  5.95  3.70  2.41  5.41  3.53
#> 5:      505  1.28  3.37  5.05  4.67 11.30
#> 6:      506  7.69  7.46  4.35  1.28  7.50
# Monitor the visiting time and frequency of pigs in the last n days
head(res$feed_time_n)
#> Key: <location>
#>    location n_06-03 n_06-04 n_06-05 n_06-06 n_06-07 time_06-03 time_06-04
#>       <int>   <int>   <int>   <int>   <int>   <int>      <num>      <num>
#> 1:      501      99     116      97     108     121      17.62      18.14
#> 2:      502      93     102      96      75      82      17.24      16.38
#> 3:      503      83      94      81      77      96      18.15      16.92
#> 4:      504      84      81      83      74      85      18.61      17.66
#> 5:      505      78      89      99     107     115      16.82      17.51
#> 6:      506      65      67      69      78      80      18.65      17.29
#>    time_06-05 time_06-06 time_06-07
#>         <num>      <num>      <num>
#> 1:      18.64      18.62      18.54
#> 2:      16.92      16.48      16.30
#> 3:      15.49      15.84      15.86
#> 4:      16.87      17.10      16.49
#> 5:      16.73      17.26      16.33
#> 6:      17.48      19.43      18.44
# Monitor the low feedintake over the last n days
head(res$low_feedintake)
#>    location responder 06-03 06-04 06-05 06-06 06-07 sum_feedintake
#>       <int>     <int> <num> <num> <num> <num> <num>          <num>
#> 1:      507   2315012    NA    NA    NA 0.029 0.003           0.03
#> 2:      502        NA 0.081 0.046 0.056 0.087 0.027           0.30
#> 3:      510        NA    NA 0.048 0.208 0.014    NA           0.27
#> 4:      503        NA    NA 0.212 0.022    NA    NA           0.23
#> 5:      509        NA    NA    NA 0.010    NA 0.152           0.16
#> 6:      504        NA 0.026    NA 0.023    NA    NA           0.05
# Monitor the total feed intake over the last n days
head(res$all_feedintake)
#> Key: <location>
#>    location 06-03 06-04 06-05 06-06 06-07 all_feedintake
#>      <char> <num> <num> <num> <num> <num>          <num>
#> 1:      501 41.30 43.52 46.97 45.56 46.34         223.69
#> 2:      502 46.95 46.13 49.73 46.41 50.10         239.32
#> 3:      503 51.22 49.40 47.49 48.06 48.47         244.65
#> 4:      504 48.68 49.71 48.49 48.85 47.98         243.70
#> 5:      505 43.64 46.99 47.73 47.40 44.47         230.23
#> 6:      506 47.60 46.10 45.98 50.43 47.72         237.83
# Monitor the average feed intake over the last n days
head(res$mean_feedintake)
#> Key: <date>
#>      date 5_feed all_feedintake   5_n 5_mean_feed
#>    <char>  <num>          <num> <int>       <num>
#> 1:  06-03 460.51         460.51   147        3.13
#> 2:  06-04 464.41         464.41   146        3.18
#> 3:  06-05 469.79         469.79   145        3.24
#> 4:  06-06 470.22         470.22   146        3.22
#> 5:  06-07 469.56         469.56   146        3.22
# Monitor the average weight per pen over the last n days
head(res$house_weight)
#> Key: <date>
#>      date house_5
#>    <char>   <num>
#> 1:  06-03   75.08
#> 2:  06-04   76.42
#> 3:  06-05   77.64
#> 4:  06-06   79.34
#> 5:  06-07   80.61
# Monitor visit time in each hour over the last 1 day.
head(res$visit_n_hour)
#> Key: <location>
#>    location     0     1     2     3     4     5     6     7     8     9    10
#>       <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
#> 1:      501     3     5     4     4     4     3     4     9     5     5     8
#> 2:      502     4     1     3     4     1     2     4     4     4     4     4
#> 3:      503     2     7     4     3     1     3     3     3     4     2     7
#> 4:      504     4     4     1     5     1     2     3     3     3     5     4
#> 5:      505     5     9     4     3     2     4     4     2     4     5     3
#> 6:      506     3     4     2     3     1     1     3     2     4     2     4
#>       11    12    13    14    15    16    17    18    19    20    21    22
#>    <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
#> 1:     4     4     6     4     9    10     6     6     4     5     3     2
#> 2:     3     3     4     5     5     5     4     5     5     4     1     5
#> 3:     5     4     4     4     4     5     7     5     4     4     1     6
#> 4:     5     3     5     3     9     4     5     3     4     2     1     3
#> 5:     8     7     6     6     6     7     8     6     4     5     4     1
#> 6:     6     2     4     6     3     5     4     3     3     4     5     5
#>       23
#>    <int>
#> 1:     4
#> 2:    NA
#> 3:     4
#> 4:     3
#> 5:     2
#> 6:     1
# Monitor feed intake time in each hour over the last 1 day.
head(res$feed_time_hour)
#> Key: <location>
#>    location     0     1     2     3     4     5     6     7     8     9    10
#>       <int> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num>
#> 1:      501  9.57 33.95 48.88 59.77 34.53 36.38 50.50 41.57 52.70 55.47 48.17
#> 2:      502 36.35 12.25 37.57 53.27 11.37 18.67 36.13 62.23 42.80 49.67 48.58
#> 3:      503 18.97 39.23 40.38 21.13  6.62 29.62 50.40 41.62 71.25 23.22 50.48
#> 4:      504 33.45 56.98  7.00 68.78 12.65 25.65 34.40 28.45 36.30 60.68 56.87
#> 5:      505 30.82 34.20 17.30 25.02 18.45 46.52 52.07 21.17 45.72 74.60 44.17
#> 6:      506 66.65 50.72 16.48 31.30  8.08 18.82 58.05 47.10 57.83 46.55 54.50
#>       11    12    13    14    15    16    17    18    19    20    21    22
#>    <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num>
#> 1: 60.68 48.07 48.53 51.03 52.95 43.55 64.73 60.97 55.23 45.68 49.97 21.82
#> 2: 45.80 25.98 51.55 58.68 61.32 56.58 64.05 47.82 65.83 41.63  6.27 43.73
#> 3: 40.33 21.33 50.57 64.28 55.67 48.55 54.83 62.55 41.50 53.48  5.27 45.27
#> 4: 60.58 41.45 68.10 47.85 44.65 60.88 56.72 51.77 46.52 19.98  4.45 23.38
#> 5: 40.10 48.08 32.12 52.98 57.20 44.18 57.08 67.37 56.15 63.82 33.68  1.47
#> 6: 73.53 50.00 50.40 76.15 42.93 58.73 62.28 56.82 58.42 50.52 42.28 27.53
#>       23
#>    <num>
#> 1: 37.85
#> 2:    NA
#> 3: 15.00
#> 4: 41.63
#> 5: 15.62
#> 6:  0.83
# Monitor feed intake in each hour over the last 1 day.
head(res$feed_intake_hour)
#> Key: <location>
#>    location     0     1     2     3     4     5     6     7     8     9    10
#>       <int> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num>
#> 1:      501  0.40  1.10  2.05  2.18  1.90  1.41  2.23  2.26  1.85  2.29  2.13
#> 2:      502  1.73  0.81  1.80  2.45  0.53  1.00  1.76  3.04  1.86  2.58  2.39
#> 3:      503  0.84  1.90  2.20  1.07  0.31  1.37  2.44  2.53  3.84  1.01  2.41
#> 4:      504  1.32  2.61  0.35  3.07  0.72  1.52  1.75  1.34  1.66  2.63  2.85
#> 5:      505  1.29  1.16  0.56  1.21  0.89  2.02  2.39  0.97  2.24  2.87  2.32
#> 6:      506  2.60  2.15  0.72  1.43  0.47  0.66  2.44  2.02  2.72  2.09  2.13
#>       11    12    13    14    15    16    17    18    19    20    21    22
#>    <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num>
#> 1:  2.28  1.94  2.48  1.78  2.20  1.51  2.42  2.71  2.80  2.26  2.27  0.80
#> 2:  2.19  1.50  2.63  2.89  2.98  2.89  3.69  2.80  3.33  2.38  0.36  2.50
#> 3:  1.92  1.13  2.52  3.35  3.10  2.25  3.01  3.18  1.96  2.48  0.21  2.52
#> 4:  2.91  2.38  3.44  2.35  2.11  3.10  2.93  2.80  2.17  0.88  0.28  1.02
#> 5:  1.47  2.22  1.67  2.65  2.06  2.15  1.64  3.80  3.38  3.34  1.44  0.08
#> 6:  3.11  1.73  2.24  3.74  1.47  1.79  3.10  2.63  3.00  2.27  1.91  1.30
#>       23
#>    <num>
#> 1:  1.07
#> 2:    NA
#> 3:  0.90
#> 4:  1.79
#> 5:  0.64
#> 6:  0.02

monitor_all

Combine the fid_monitor(), station_monitor(), and table_monitor() functions together. You can use monitor_all() to monitor all by hands.

# Load CSV data
data <- data.table::fread("C:/Users/Dell/Documents/projects/pptsdm_data/ppt_monitor_test_data.csv")
monitor_all(data, begin_date = "2024-05-01", days = 5, save_path = "C:/Users/Dell/Downloads/test")
#> Warning: Removed 2 rows containing missing values or values outside the scale range
#> (`geom_col()`).
#> Warning: Removed 1 row containing missing values or values outside the scale range
#> (`geom_col()`).
#> Warning: Removed 2 rows containing missing values or values outside the scale range
#> (`geom_col()`).
#> Warning: Removed 3 rows containing missing values or values outside the scale range
#> (`geom_col()`).
#> Warning: Removed 1 row containing missing values or values outside the scale range
#> (`geom_col()`).
#> Removed 1 row containing missing values or values outside the scale range
#> (`geom_col()`).
#> Warning: Removed 3 rows containing missing values or values outside the scale range
#> (`geom_col()`).
#> Warning: Removed 2 rows containing missing values or values outside the scale range
#> (`geom_col()`).
#> Warning: Removed 3 rows containing missing values or values outside the scale range
#> (`geom_col()`).
#> Warning: Removed 1 row containing missing values or values outside the scale range
#> (`geom_col()`).
#> $responder_na
#>     location 06-03 06-04 06-05 06-06 06-07 total_nas
#>       <char> <int> <int> <int> <int> <int>     <num>
#>  1:      501     0     0     0     0     0         0
#>  2:      502     2     1     1     3     2         9
#>  3:      503     0     2     2     0     0         4
#>  4:      504     2     0     2     0     0         4
#>  5:      505     0     0     0     0     0         0
#>  6:      506     0     0     0     0     0         0
#>  7:      507     1     1     1     0     0         3
#>  8:      508     0     0     0     0     1         1
#>  9:      509     0     0     1     0     2         3
#> 10:      510     0     1     2     1     0         4
#> 
#> $extreme_weight
#> Key: <location>
#>     location 06-03 06-04 06-05 06-06 06-07
#>        <int> <num> <num> <num> <num> <num>
#>  1:      501  7.07  4.31  4.12  2.78  5.79
#>  2:      502  5.38  6.86  3.12  6.67  7.32
#>  3:      503  4.82  5.32  6.17  5.19  5.21
#>  4:      504  5.95  3.70  2.41  5.41  3.53
#>  5:      505  1.28  3.37  5.05  4.67 11.30
#>  6:      506  7.69  7.46  4.35  1.28  7.50
#>  7:      507  7.59  3.85  4.29  2.41  8.43
#>  8:      508  1.47  1.37  2.63  1.32  6.10
#>  9:      509  6.84  4.62  4.31  6.78  8.13
#> 10:      510  6.74  3.12  7.58  4.41  8.57
#> 
#> $feed_time_n
#> Key: <location>
#>     location n_06-03 n_06-04 n_06-05 n_06-06 n_06-07 time_06-03 time_06-04
#>        <int>   <int>   <int>   <int>   <int>   <int>      <num>      <num>
#>  1:      501      99     116      97     108     121      17.62      18.14
#>  2:      502      93     102      96      75      82      17.24      16.38
#>  3:      503      83      94      81      77      96      18.15      16.92
#>  4:      504      84      81      83      74      85      18.61      17.66
#>  5:      505      78      89      99     107     115      16.82      17.51
#>  6:      506      65      67      69      78      80      18.65      17.29
#>  7:      507      79      78      70      83      83      17.45      15.67
#>  8:      508      68      73      76      76      82      18.12      17.93
#>  9:      509     117     130     116     118     123      17.97      16.86
#> 10:      510      89      96      66      68      70      19.07      19.84
#>     time_06-05 time_06-06 time_06-07
#>          <num>      <num>      <num>
#>  1:      18.64      18.62      18.54
#>  2:      16.92      16.48      16.30
#>  3:      15.49      15.84      15.86
#>  4:      16.87      17.10      16.49
#>  5:      16.73      17.26      16.33
#>  6:      17.48      19.43      18.44
#>  7:      15.85      15.88      16.28
#>  8:      17.49      18.09      17.18
#>  9:      17.39      17.98      16.58
#> 10:      17.89      18.17      17.72
#> 
#> $low_feedintake
#>    location responder 06-03 06-04 06-05 06-06 06-07 sum_feedintake
#>       <int>     <int> <num> <num> <num> <num> <num>          <num>
#> 1:      507   2315012    NA    NA    NA 0.029 0.003           0.03
#> 2:      502        NA 0.081 0.046 0.056 0.087 0.027           0.30
#> 3:      510        NA    NA 0.048 0.208 0.014    NA           0.27
#> 4:      503        NA    NA 0.212 0.022    NA    NA           0.23
#> 5:      509        NA    NA    NA 0.010    NA 0.152           0.16
#> 6:      504        NA 0.026    NA 0.023    NA    NA           0.05
#> 7:      507        NA 0.010 0.010 0.010    NA    NA           0.03
#> 8:      508        NA    NA    NA    NA    NA 0.010           0.01
#> 
#> $all_feedintake
#> Key: <location>
#>     location 06-03 06-04 06-05 06-06 06-07 all_feedintake
#>       <char> <num> <num> <num> <num> <num>          <num>
#>  1:      501 41.30 43.52 46.97 45.56 46.34         223.69
#>  2:      502 46.95 46.13 49.73 46.41 50.10         239.32
#>  3:      503 51.22 49.40 47.49 48.06 48.47         244.65
#>  4:      504 48.68 49.71 48.49 48.85 47.98         243.70
#>  5:      505 43.64 46.99 47.73 47.40 44.47         230.23
#>  6:      506 47.60 46.10 45.98 50.43 47.72         237.83
#>  7:      507 44.87 41.04 43.98 43.24 44.58         217.71
#>  8:      508 44.22 45.83 43.71 44.74 43.99         222.50
#>  9:      509 48.30 48.09 51.44 50.91 50.07         248.80
#> 10:      510 43.86 47.92 44.62 44.72 46.01         227.12
#> 
#> $mean_feedintake
#> Key: <date>
#>      date 5_feed all_feedintake   5_n 5_mean_feed
#>    <char>  <num>          <num> <int>       <num>
#> 1:  06-03 460.51         460.51   147        3.13
#> 2:  06-04 464.41         464.41   146        3.18
#> 3:  06-05 469.79         469.79   145        3.24
#> 4:  06-06 470.22         470.22   146        3.22
#> 5:  06-07 469.56         469.56   146        3.22
#> 
#> $house_weight
#> Key: <date>
#>      date house_5
#>    <char>   <num>
#> 1:  06-03   75.08
#> 2:  06-04   76.42
#> 3:  06-05   77.64
#> 4:  06-06   79.34
#> 5:  06-07   80.61
#> 
#> $visit_n_hour
#> Key: <location>
#>     location     0     1     2     3     4     5     6     7     8     9    10
#>        <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
#>  1:      501     3     5     4     4     4     3     4     9     5     5     8
#>  2:      502     4     1     3     4     1     2     4     4     4     4     4
#>  3:      503     2     7     4     3     1     3     3     3     4     2     7
#>  4:      504     4     4     1     5     1     2     3     3     3     5     4
#>  5:      505     5     9     4     3     2     4     4     2     4     5     3
#>  6:      506     3     4     2     3     1     1     3     2     4     2     4
#>  7:      507     4     1     5     3     1     2     3     5     4     3     3
#>  8:      508     5     3     1     4     3     3     3     3     4     2     3
#>  9:      509     3     5     5     1     3     2     2     4     6     4     3
#> 10:      510     3    NA     3     2     3     2     1     3     2     3     3
#>        11    12    13    14    15    16    17    18    19    20    21    22
#>     <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
#>  1:     4     4     6     4     9    10     6     6     4     5     3     2
#>  2:     3     3     4     5     5     5     4     5     5     4     1     5
#>  3:     5     4     4     4     4     5     7     5     4     4     1     6
#>  4:     5     3     5     3     9     4     5     3     4     2     1     3
#>  5:     8     7     6     6     6     7     8     6     4     5     4     1
#>  6:     6     2     4     6     3     5     4     3     3     4     5     5
#>  7:     6     5     7     3     4     5     5     4     4    NA    NA     5
#>  8:     5     4     3     3     6     5     4     3     3     4     4     3
#>  9:     8     5     5    10     8    12     4     7     3     7     9     3
#> 10:     3     4     2     3     7     5     3     3     2     3     4     2
#>        23
#>     <int>
#>  1:     4
#>  2:    NA
#>  3:     4
#>  4:     3
#>  5:     2
#>  6:     1
#>  7:     1
#>  8:     2
#>  9:     6
#> 10:     4
#> 
#> $feed_time_hour
#> Key: <location>
#>     location     0     1     2     3     4     5     6     7     8     9    10
#>        <int> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num>
#>  1:      501  9.57 33.95 48.88 59.77 34.53 36.38 50.50 41.57 52.70 55.47 48.17
#>  2:      502 36.35 12.25 37.57 53.27 11.37 18.67 36.13 62.23 42.80 49.67 48.58
#>  3:      503 18.97 39.23 40.38 21.13  6.62 29.62 50.40 41.62 71.25 23.22 50.48
#>  4:      504 33.45 56.98  7.00 68.78 12.65 25.65 34.40 28.45 36.30 60.68 56.87
#>  5:      505 30.82 34.20 17.30 25.02 18.45 46.52 52.07 21.17 45.72 74.60 44.17
#>  6:      506 66.65 50.72 16.48 31.30  8.08 18.82 58.05 47.10 57.83 46.55 54.50
#>  7:      507 41.03 13.78 51.38 44.87 20.98 28.35 39.22 56.10 45.87 49.72 40.87
#>  8:      508 48.92 21.32  6.23 29.35 47.57 70.88 40.70 41.55 50.60 45.07 34.77
#>  9:      509 31.62 78.10 18.28 13.12 26.80 14.27 27.50 66.20 48.47 56.48 53.45
#> 10:      510 20.72    NA 58.38 30.07 59.98 47.35 12.75 55.05 42.08 57.80 54.02
#>        11    12    13    14    15    16    17    18    19    20    21    22
#>     <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num>
#>  1: 60.68 48.07 48.53 51.03 52.95 43.55 64.73 60.97 55.23 45.68 49.97 21.82
#>  2: 45.80 25.98 51.55 58.68 61.32 56.58 64.05 47.82 65.83 41.63  6.27 43.73
#>  3: 40.33 21.33 50.57 64.28 55.67 48.55 54.83 62.55 41.50 53.48  5.27 45.27
#>  4: 60.58 41.45 68.10 47.85 44.65 60.88 56.72 51.77 46.52 19.98  4.45 23.38
#>  5: 40.10 48.08 32.12 52.98 57.20 44.18 57.08 67.37 56.15 63.82 33.68  1.47
#>  6: 73.53 50.00 50.40 76.15 42.93 58.73 62.28 56.82 58.42 50.52 42.28 27.53
#>  7: 53.45 39.77 44.08 61.90 59.02 59.58 51.63 63.30 54.67    NA    NA 48.00
#>  8: 71.40 58.88 55.20 19.07 56.52 55.00 74.32 52.77 45.13 30.10 28.83 25.30
#>  9: 60.33 32.93 46.25 58.73 50.37 63.55 49.32 70.85 42.20 34.58 34.50  7.27
#> 10: 53.03 79.35 35.85 58.28 66.23 54.53 67.92 48.00 25.55 32.32 40.65 27.12
#>        23
#>     <num>
#>  1: 37.85
#>  2:    NA
#>  3: 15.00
#>  4: 41.63
#>  5: 15.62
#>  6:  0.83
#>  7:  9.15
#>  8: 21.32
#>  9: 15.37
#> 10: 36.28
#> 
#> $feed_intake_hour
#> Key: <location>
#>     location     0     1     2     3     4     5     6     7     8     9    10
#>        <int> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num>
#>  1:      501  0.40  1.10  2.05  2.18  1.90  1.41  2.23  2.26  1.85  2.29  2.13
#>  2:      502  1.73  0.81  1.80  2.45  0.53  1.00  1.76  3.04  1.86  2.58  2.39
#>  3:      503  0.84  1.90  2.20  1.07  0.31  1.37  2.44  2.53  3.84  1.01  2.41
#>  4:      504  1.32  2.61  0.35  3.07  0.72  1.52  1.75  1.34  1.66  2.63  2.85
#>  5:      505  1.29  1.16  0.56  1.21  0.89  2.02  2.39  0.97  2.24  2.87  2.32
#>  6:      506  2.60  2.15  0.72  1.43  0.47  0.66  2.44  2.02  2.72  2.09  2.13
#>  7:      507  1.73  0.60  2.06  2.28  0.82  1.35  1.88  2.61  1.94  2.10  1.48
#>  8:      508  1.81  0.80  0.19  1.09  2.23  3.16  1.59  1.97  1.99  1.92  1.21
#>  9:      509  1.55  4.37  1.29  0.80  1.32  0.45  1.22  3.39  2.64  2.89  2.88
#> 10:      510  0.82    NA  2.50  1.27  2.87  1.63  0.54  2.55  1.76  2.52  2.54
#>        11    12    13    14    15    16    17    18    19    20    21    22
#>     <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num>
#>  1:  2.28  1.94  2.48  1.78  2.20  1.51  2.42  2.71  2.80  2.26  2.27  0.80
#>  2:  2.19  1.50  2.63  2.89  2.98  2.89  3.69  2.80  3.33  2.38  0.36  2.50
#>  3:  1.92  1.13  2.52  3.35  3.10  2.25  3.01  3.18  1.96  2.48  0.21  2.52
#>  4:  2.91  2.38  3.44  2.35  2.11  3.10  2.93  2.80  2.17  0.88  0.28  1.02
#>  5:  1.47  2.22  1.67  2.65  2.06  2.15  1.64  3.80  3.38  3.34  1.44  0.08
#>  6:  3.11  1.73  2.24  3.74  1.47  1.79  3.10  2.63  3.00  2.27  1.91  1.30
#>  7:  2.43  2.05  1.60  2.75  2.82  2.41  2.75  3.26  3.07    NA    NA  2.02
#>  8:  3.38  2.73  2.04  0.87  2.19  2.23  3.39  2.64  2.18  1.21  1.39  0.84
#>  9:  3.29  1.44  1.73  2.42  2.29  2.67  3.44  3.86  1.83  1.59  1.53  0.40
#> 10:  2.24  3.77  1.20  2.77  2.19  2.42  3.39  2.52  1.06  1.61  1.62  0.91
#>        23
#>     <num>
#>  1:  1.07
#>  2:    NA
#>  3:  0.90
#>  4:  1.79
#>  5:  0.64
#>  6:  0.02
#>  7:  0.56
#>  8:  0.92
#>  9:  0.81
#> 10:  1.30

monitor_schedule

You can use monitor_schedule to set when to run the fid_monitor()station_monitor() and table_monitor().

# Set monitor task
monitor_schedule(
  taskname = "ppt_csv_monitor",
  schedule = "DAILY",
  starttime = "10:05",
  startdate = format(Sys.Date(), "%Y/%m/%d"),
  rscript_args = list(house_width = "1", 
                      days = 5,
                      begin_date = "2024-05-01", 
                      csv_path = "C:/Users/Dell/Documents/projects/pptsdm_data",
                      save_path = "C:/Users/Dell/Downloads/test"))
#> [1] "SUCCESS: The scheduled task \"ppt_csv_monitor\" has successfully been created."
# Delete monitor task
taskscheduleR::taskscheduler_delete("ppt_csv_monitor")
#> [1] 0

process_data

process_data() is used to preprocess the read CSV data.

# Load CSV data
data <- data.table::fread("C:/Users/Dell/Documents/projects/pptsdm_data/ppt_monitor_test_data.csv")
processed_data <- process_data(data = data)
head(processed_data)
#>    responder location       date seq_days seq_in_day seq_in_location
#>       <char>   <char>     <IDat>    <int>      <int>           <int>
#> 1:   2311763      503 2024-05-28        1          1              10
#> 2:   2311763      503 2024-05-28        1          2              35
#> 3:   2311763      503 2024-05-28        1          3              43
#> 4:   2311763      503 2024-05-28        1          4              45
#> 5:   2311763      503 2024-05-28        1          5              50
#> 6:   2311763      503 2024-05-28        1          6              52
#>    feed_intake weight
#>          <num>  <num>
#> 1:         724  71000
#> 2:          12  70500
#> 3:          10  70000
#> 4:           0  70000
#> 5:           0  70000
#> 6:        1447  70500

house_weight

house_weight() is primarily used to monitor the average weight of pigs in each barn.

# Load CSV data
data <- data.table::fread("C:/Users/Dell/Documents/projects/pptsdm_data/ppt_monitor_test_data.csv")
head(house_weight(data = data, days = 5))
#> Key: <date>
#>      date house_5
#>    <char>   <num>
#> 1:  06-03   75.08
#> 2:  06-04   76.42
#> 3:  06-05   77.64
#> 4:  06-06   79.34
#> 5:  06-07   80.61

responder_na

responder_na() primarily monitors the 访问组 for each station.

# Load CSV data
data <- data.table::fread("C:/Users/Dell/Documents/projects/pptsdm_data/ppt_monitor_test_data.csv")
print(responder_na(data = data, days = 5))
#>     location 06-03 06-04 06-05 06-06 06-07 total_nas
#>       <char> <int> <int> <int> <int> <int>     <num>
#>  1:      501     0     0     0     0     0         0
#>  2:      502     2     1     1     3     2         9
#>  3:      503     0     2     2     0     0         4
#>  4:      504     2     0     2     0     0         4
#>  5:      505     0     0     0     0     0         0
#>  6:      506     0     0     0     0     0         0
#>  7:      507     1     1     1     0     0         3
#>  8:      508     0     0     0     0     1         1
#>  9:      509     0     0     1     0     2         3
#> 10:      510     0     1     2     1     0         4

extreme_time_n

extreme_time_n() primarily monitors abnormal weight records, access frequency, and access times.

# Load CSV data
data <- data.table::fread("C:/Users/Dell/Documents/projects/pptsdm_data/ppt_monitor_test_data.csv")
print(extreme_time_n(data = data, days = 5))
#> $weight_outlier
#> Key: <location>
#>     location 06-03 06-04 06-05 06-06 06-07
#>        <int> <num> <num> <num> <num> <num>
#>  1:      501  7.07  4.31  4.12  2.78  5.79
#>  2:      502  5.38  6.86  3.12  6.67  7.32
#>  3:      503  4.82  5.32  6.17  5.19  5.21
#>  4:      504  5.95  3.70  2.41  5.41  3.53
#>  5:      505  1.28  3.37  5.05  4.67 11.30
#>  6:      506  7.69  7.46  4.35  1.28  7.50
#>  7:      507  7.59  3.85  4.29  2.41  8.43
#>  8:      508  1.47  1.37  2.63  1.32  6.10
#>  9:      509  6.84  4.62  4.31  6.78  8.13
#> 10:      510  6.74  3.12  7.58  4.41  8.57
#> 
#> $feedintake
#> Key: <location>
#>     location n_06-03 n_06-04 n_06-05 n_06-06 n_06-07 time_06-03 time_06-04
#>        <int>   <int>   <int>   <int>   <int>   <int>      <num>      <num>
#>  1:      501      99     116      97     108     121      17.62      18.14
#>  2:      502      93     102      96      75      82      17.24      16.38
#>  3:      503      83      94      81      77      96      18.15      16.92
#>  4:      504      84      81      83      74      85      18.61      17.66
#>  5:      505      78      89      99     107     115      16.82      17.51
#>  6:      506      65      67      69      78      80      18.65      17.29
#>  7:      507      79      78      70      83      83      17.45      15.67
#>  8:      508      68      73      76      76      82      18.12      17.93
#>  9:      509     117     130     116     118     123      17.97      16.86
#> 10:      510      89      96      66      68      70      19.07      19.84
#>     time_06-05 time_06-06 time_06-07
#>          <num>      <num>      <num>
#>  1:      18.64      18.62      18.54
#>  2:      16.92      16.48      16.30
#>  3:      15.49      15.84      15.86
#>  4:      16.87      17.10      16.49
#>  5:      16.73      17.26      16.33
#>  6:      17.48      19.43      18.44
#>  7:      15.85      15.88      16.28
#>  8:      17.49      18.09      17.18
#>  9:      17.39      17.98      16.58
#> 10:      17.89      18.17      17.72

low_feedintake

low_feedintake() primarily monitors individuals with low feed intake.

# Load CSV data
data <- data.table::fread("C:/Users/Dell/Documents/projects/pptsdm_data/ppt_monitor_test_data.csv")
print(low_feedintake(data = data, days = 5))
#>    location responder 06-03 06-04 06-05 06-06 06-07 sum_feedintake
#>       <int>     <int> <num> <num> <num> <num> <num>          <num>
#> 1:      507   2315012    NA    NA    NA 0.029 0.003           0.03
#> 2:      502        NA 0.081 0.046 0.056 0.087 0.027           0.30
#> 3:      510        NA    NA 0.048 0.208 0.014    NA           0.27
#> 4:      503        NA    NA 0.212 0.022    NA    NA           0.23
#> 5:      509        NA    NA    NA 0.010    NA 0.152           0.16
#> 6:      504        NA 0.026    NA 0.023    NA    NA           0.05
#> 7:      507        NA 0.010 0.010 0.010    NA    NA           0.03
#> 8:      508        NA    NA    NA    NA    NA 0.010           0.01

all_feedintake

all_feedintake() is used to monitor the total daily feed intake for each station.

# Load CSV data
data <- data.table::fread("C:/Users/Dell/Documents/projects/pptsdm_data/ppt_monitor_test_data.csv")
print(all_feedintake(data = data, days = 5))
#> Key: <location>
#>     location 06-03 06-04 06-05 06-06 06-07 all_feedintake
#>       <char> <num> <num> <num> <num> <num>          <num>
#>  1:      501 41.30 43.52 46.97 45.56 46.34         223.69
#>  2:      502 46.95 46.13 49.73 46.41 50.10         239.32
#>  3:      503 51.22 49.40 47.49 48.06 48.47         244.65
#>  4:      504 48.68 49.71 48.49 48.85 47.98         243.70
#>  5:      505 43.64 46.99 47.73 47.40 44.47         230.23
#>  6:      506 47.60 46.10 45.98 50.43 47.72         237.83
#>  7:      507 44.87 41.04 43.98 43.24 44.58         217.71
#>  8:      508 44.22 45.83 43.71 44.74 43.99         222.50
#>  9:      509 48.30 48.09 51.44 50.91 50.07         248.80
#> 10:      510 43.86 47.92 44.62 44.72 46.01         227.12

number_location

number_location() is used to calculate the number of pigs at each station.

# Load CSV data
data <- data.table::fread("C:/Users/Dell/Documents/projects/pptsdm_data/ppt_monitor_test_data.csv")
print(number_location(data = data, house_width = "1", days = 5))
#> Key: <date>
#>      date     5
#>    <char> <int>
#> 1:  06-03   147
#> 2:  06-04   146
#> 3:  06-05   145
#> 4:  06-06   146
#> 5:  06-07   146

house_feedintake

house_feedintake() is used to calculate the total feed intake at each measurement station.

# Load CSV data
data <- data.table::fread("C:/Users/Dell/Documents/projects/pptsdm_data/ppt_monitor_test_data.csv")
print(house_feedintake(data = data, house_width = "1", days = 5))
#> Key: <date>
#>      date      5 all_feedintake
#>    <char>  <num>          <num>
#> 1:  06-03 460.51         460.51
#> 2:  06-04 464.41         464.41
#> 3:  06-05 469.79         469.79
#> 4:  06-06 470.22         470.22
#> 5:  06-07 469.56         469.56

hour_stat

hour_stat() is used to monitor the number of visits, visit times, and feed intake of pigs at each measurement station for every hour within a 24-hour period.

# Load CSV data
data <- data.table::fread("C:/Users/Dell/Documents/projects/pptsdm_data/ppt_monitor_test_data.csv")
print(hour_stat(data = data))
#> $visit_n
#> Key: <location>
#>     location     0     1     2     3     4     5     6     7     8     9    10
#>        <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
#>  1:      501     3     5     4     4     4     3     4     9     5     5     8
#>  2:      502     4     1     3     4     1     2     4     4     4     4     4
#>  3:      503     2     7     4     3     1     3     3     3     4     2     7
#>  4:      504     4     4     1     5     1     2     3     3     3     5     4
#>  5:      505     5     9     4     3     2     4     4     2     4     5     3
#>  6:      506     3     4     2     3     1     1     3     2     4     2     4
#>  7:      507     4     1     5     3     1     2     3     5     4     3     3
#>  8:      508     5     3     1     4     3     3     3     3     4     2     3
#>  9:      509     3     5     5     1     3     2     2     4     6     4     3
#> 10:      510     3    NA     3     2     3     2     1     3     2     3     3
#>        11    12    13    14    15    16    17    18    19    20    21    22
#>     <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
#>  1:     4     4     6     4     9    10     6     6     4     5     3     2
#>  2:     3     3     4     5     5     5     4     5     5     4     1     5
#>  3:     5     4     4     4     4     5     7     5     4     4     1     6
#>  4:     5     3     5     3     9     4     5     3     4     2     1     3
#>  5:     8     7     6     6     6     7     8     6     4     5     4     1
#>  6:     6     2     4     6     3     5     4     3     3     4     5     5
#>  7:     6     5     7     3     4     5     5     4     4    NA    NA     5
#>  8:     5     4     3     3     6     5     4     3     3     4     4     3
#>  9:     8     5     5    10     8    12     4     7     3     7     9     3
#> 10:     3     4     2     3     7     5     3     3     2     3     4     2
#>        23
#>     <int>
#>  1:     4
#>  2:    NA
#>  3:     4
#>  4:     3
#>  5:     2
#>  6:     1
#>  7:     1
#>  8:     2
#>  9:     6
#> 10:     4
#> 
#> $feed_time
#> Key: <location>
#>     location     0     1     2     3     4     5     6     7     8     9    10
#>        <int> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num>
#>  1:      501  9.57 33.95 48.88 59.77 34.53 36.38 50.50 41.57 52.70 55.47 48.17
#>  2:      502 36.35 12.25 37.57 53.27 11.37 18.67 36.13 62.23 42.80 49.67 48.58
#>  3:      503 18.97 39.23 40.38 21.13  6.62 29.62 50.40 41.62 71.25 23.22 50.48
#>  4:      504 33.45 56.98  7.00 68.78 12.65 25.65 34.40 28.45 36.30 60.68 56.87
#>  5:      505 30.82 34.20 17.30 25.02 18.45 46.52 52.07 21.17 45.72 74.60 44.17
#>  6:      506 66.65 50.72 16.48 31.30  8.08 18.82 58.05 47.10 57.83 46.55 54.50
#>  7:      507 41.03 13.78 51.38 44.87 20.98 28.35 39.22 56.10 45.87 49.72 40.87
#>  8:      508 48.92 21.32  6.23 29.35 47.57 70.88 40.70 41.55 50.60 45.07 34.77
#>  9:      509 31.62 78.10 18.28 13.12 26.80 14.27 27.50 66.20 48.47 56.48 53.45
#> 10:      510 20.72    NA 58.38 30.07 59.98 47.35 12.75 55.05 42.08 57.80 54.02
#>        11    12    13    14    15    16    17    18    19    20    21    22
#>     <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num>
#>  1: 60.68 48.07 48.53 51.03 52.95 43.55 64.73 60.97 55.23 45.68 49.97 21.82
#>  2: 45.80 25.98 51.55 58.68 61.32 56.58 64.05 47.82 65.83 41.63  6.27 43.73
#>  3: 40.33 21.33 50.57 64.28 55.67 48.55 54.83 62.55 41.50 53.48  5.27 45.27
#>  4: 60.58 41.45 68.10 47.85 44.65 60.88 56.72 51.77 46.52 19.98  4.45 23.38
#>  5: 40.10 48.08 32.12 52.98 57.20 44.18 57.08 67.37 56.15 63.82 33.68  1.47
#>  6: 73.53 50.00 50.40 76.15 42.93 58.73 62.28 56.82 58.42 50.52 42.28 27.53
#>  7: 53.45 39.77 44.08 61.90 59.02 59.58 51.63 63.30 54.67    NA    NA 48.00
#>  8: 71.40 58.88 55.20 19.07 56.52 55.00 74.32 52.77 45.13 30.10 28.83 25.30
#>  9: 60.33 32.93 46.25 58.73 50.37 63.55 49.32 70.85 42.20 34.58 34.50  7.27
#> 10: 53.03 79.35 35.85 58.28 66.23 54.53 67.92 48.00 25.55 32.32 40.65 27.12
#>        23
#>     <num>
#>  1: 37.85
#>  2:    NA
#>  3: 15.00
#>  4: 41.63
#>  5: 15.62
#>  6:  0.83
#>  7:  9.15
#>  8: 21.32
#>  9: 15.37
#> 10: 36.28
#> 
#> $feed_intake
#> Key: <location>
#>     location     0     1     2     3     4     5     6     7     8     9    10
#>        <int> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num>
#>  1:      501  0.40  1.10  2.05  2.18  1.90  1.41  2.23  2.26  1.85  2.29  2.13
#>  2:      502  1.73  0.81  1.80  2.45  0.53  1.00  1.76  3.04  1.86  2.58  2.39
#>  3:      503  0.84  1.90  2.20  1.07  0.31  1.37  2.44  2.53  3.84  1.01  2.41
#>  4:      504  1.32  2.61  0.35  3.07  0.72  1.52  1.75  1.34  1.66  2.63  2.85
#>  5:      505  1.29  1.16  0.56  1.21  0.89  2.02  2.39  0.97  2.24  2.87  2.32
#>  6:      506  2.60  2.15  0.72  1.43  0.47  0.66  2.44  2.02  2.72  2.09  2.13
#>  7:      507  1.73  0.60  2.06  2.28  0.82  1.35  1.88  2.61  1.94  2.10  1.48
#>  8:      508  1.81  0.80  0.19  1.09  2.23  3.16  1.59  1.97  1.99  1.92  1.21
#>  9:      509  1.55  4.37  1.29  0.80  1.32  0.45  1.22  3.39  2.64  2.89  2.88
#> 10:      510  0.82    NA  2.50  1.27  2.87  1.63  0.54  2.55  1.76  2.52  2.54
#>        11    12    13    14    15    16    17    18    19    20    21    22
#>     <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num>
#>  1:  2.28  1.94  2.48  1.78  2.20  1.51  2.42  2.71  2.80  2.26  2.27  0.80
#>  2:  2.19  1.50  2.63  2.89  2.98  2.89  3.69  2.80  3.33  2.38  0.36  2.50
#>  3:  1.92  1.13  2.52  3.35  3.10  2.25  3.01  3.18  1.96  2.48  0.21  2.52
#>  4:  2.91  2.38  3.44  2.35  2.11  3.10  2.93  2.80  2.17  0.88  0.28  1.02
#>  5:  1.47  2.22  1.67  2.65  2.06  2.15  1.64  3.80  3.38  3.34  1.44  0.08
#>  6:  3.11  1.73  2.24  3.74  1.47  1.79  3.10  2.63  3.00  2.27  1.91  1.30
#>  7:  2.43  2.05  1.60  2.75  2.82  2.41  2.75  3.26  3.07    NA    NA  2.02
#>  8:  3.38  2.73  2.04  0.87  2.19  2.23  3.39  2.64  2.18  1.21  1.39  0.84
#>  9:  3.29  1.44  1.73  2.42  2.29  2.67  3.44  3.86  1.83  1.59  1.53  0.40
#> 10:  2.24  3.77  1.20  2.77  2.19  2.42  3.39  2.52  1.06  1.61  1.62  0.91
#>        23
#>     <num>
#>  1:  1.07
#>  2:    NA
#>  3:  0.90
#>  4:  1.79
#>  5:  0.64
#>  6:  0.02
#>  7:  0.56
#>  8:  0.92
#>  9:  0.81
#> 10:  1.30

That’s it ! This the end of the documented story of our package. All components are there.