[éCow] correctif bloc taureaux
This commit is contained in:
@@ -281,11 +281,11 @@ calcul_ecow_by_chep <- function(cheptel, step = 3) {
|
||||
summarise(
|
||||
utilgen = round(mean(rangVelageMipg == 1, na.rm = TRUE) * 100, 1),
|
||||
prol = round(n() / n_distinct(dateNaiss, numeroMipg) * 100, 1),
|
||||
mort = round(mean(mortsev == "O" | mortnat == "O") * 100, 1),
|
||||
mort = round((sum(mortsev == "O" | mortnat == "O", na.rm = TRUE)) / n() * 100, 1),
|
||||
|
||||
txrepros = round(
|
||||
sum(repro == "O", na.rm = TRUE) /
|
||||
sum(is.na(mortsev) | is.na(mortnat)) * 100, 1
|
||||
sum(is.na(mortsev) & is.na(mortnat)) * 100, 1
|
||||
),
|
||||
|
||||
nbpp = sum(NBPRODIPG, na.rm = TRUE),
|
||||
@@ -340,7 +340,7 @@ calcul_ecow_by_chep <- function(cheptel, step = 3) {
|
||||
group_by(pereGenetique) %>%
|
||||
summarise(
|
||||
nbfillesact_avecprod = sum(NBPRODIPG > 0, na.rm = TRUE),
|
||||
pctfillesact_avecprod = round(nbfillesact_avecprod / n() * 100, 1),
|
||||
#pctfillesact_avecprod = round(nbfillesact_avecprod / nbfilles_avecprod * 100, 1),
|
||||
|
||||
isu_fillesact = 0,
|
||||
age_sort_fillesact = ifelse(n() >= 3, round(mean(age_years, na.rm = TRUE), 1), NA),
|
||||
@@ -364,12 +364,16 @@ calcul_ecow_by_chep <- function(cheptel, step = 3) {
|
||||
.groups = "drop"
|
||||
)
|
||||
|
||||
inventaire <- bind_rows(cheptel_ecow$vaches, cheptel_ecow$produits)
|
||||
inventaire <- add_data_ecow(inventaire, czhbc)
|
||||
stats_filles_renouv <- inventaire %>%
|
||||
grp_filles_et_act <- stats_filles %>%
|
||||
dplyr::left_join(stats_filles_act, by = "pereGenetique") %>%
|
||||
mutate(
|
||||
pctfillesact_avecprod = round( nbfillesact_avecprod / nbfilles_avecprod * 100, 1 )
|
||||
)
|
||||
|
||||
stats_filles_renouv <- produits_cheptel %>%
|
||||
filter(
|
||||
sexe == "2",
|
||||
NBPRODIPG == 0
|
||||
nbFinGestation == 0 # TODO valider avec Lauréna que c'est bien ce champ là qu'on veut
|
||||
) %>%
|
||||
group_by(pereGenetique) %>%
|
||||
summarise(
|
||||
@@ -379,8 +383,7 @@ calcul_ecow_by_chep <- function(cheptel, step = 3) {
|
||||
|
||||
stats_taureaux <- stats_peres %>%
|
||||
dplyr::left_join(stats_prod_directe, by = "pereGenetique") %>%
|
||||
dplyr::left_join(stats_filles, by = "pereGenetique") %>%
|
||||
dplyr::left_join(stats_filles_act, by = "pereGenetique") %>%
|
||||
dplyr::left_join(grp_filles_et_act, by = "pereGenetique") %>%
|
||||
dplyr::left_join(stats_filles_renouv, by = "pereGenetique") %>%
|
||||
dplyr::left_join(taureaux, by = "pereGenetique")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user