[eCow] Correctif environnement

This commit is contained in:
2026-09-02 18:10:10 +02:00
parent feb04a555a
commit a3363fff11
3 changed files with 12 additions and 13 deletions
+3 -6
View File
@@ -49,7 +49,7 @@ calcul_ecow_by_chep <- function(cheptel, step = 3) {
by = c("pereGenetique" = "anim")
)
# Récupère les produits ajout des données manquantes
produits_cheptel <- add_data_ecow(cheptel_ecow$produits, cheptel_ecow$nomsparents, czhbc)
produits_cheptel <- add_data_ecow(cheptel_ecow$produits, cheptel, cheptel_ecow$nomsparents, czhbc)
###################################################################################################################
@@ -71,9 +71,6 @@ calcul_ecow_by_chep <- function(cheptel, step = 3) {
prod_vaches_corr <- apply_effet_chep(produits_vaches, effets$effets_chep, effets$rapport_MF)
# On récupère les coefficients de pondération pour les pointages au sevrage
pps <- params_ponderation$pointage$sevrage
# Ajout à la table vache des informations synthétisées de leur veaux
synth_brute_vaches <- get_synth_prod_parent(vaches, prod_vaches_corr, params_ponderation)
@@ -133,7 +130,7 @@ calcul_ecow_by_chep <- function(cheptel, step = 3) {
filter(sexe == 2)
# Petits produits issus des filles des taureaux nés dans le cheptel
pprod_filles_taureaux <- add_data_ecow(cheptel_ecow$petits_produits, cheptel_ecow$nomsparents, czhbc)
pprod_filles_taureaux <- add_data_ecow(cheptel_ecow$petits_produits, cheptel, cheptel_ecow$nomsparents, czhbc)
# Calcul de la synthèse par fille de leur produits
synth_filles_taureaux <- get_synth_prod_parent(filles_taureaux, pprod_filles_taureaux, params_ponderation)
@@ -189,7 +186,7 @@ calcul_ecow_by_chep <- function(cheptel, step = 3) {
###################################################################################################################
message("Début partie Lignées")
fondatrices <- cheptel_ecow$fondatrices
descendants <- add_data_ecow(cheptel_ecow$descendants, cheptel_ecow$nomsparents, czhbc)
descendants <- add_data_ecow(cheptel_ecow$descendants, cheptel, cheptel_ecow$nomsparents, czhbc)
vaches_lignees <- descendants %>% filter(anim %in% descendants$mereGenetique)
produits_lignees <- descendants %>% filter(mereGenetique %in% vaches_lignees$anim)
+6 -3
View File
@@ -9,11 +9,11 @@ source(here::here('R/common/utils.R'))
#' Met en forme le tableau des produits des vaches
#' Ajoutes les colonnes nécessaires au calcul du rang ecow des vaches
#' @param produits_vaches dataframe. Tab des produits des vaches du cheptel
add_data_ecow <- function(liste_produits, noms_parents, czhbc){
add_data_ecow <- function(liste_produits, cheptel, noms_parents, czhbc){
#Ajout d'une colonne avec le nombre de produits IPG (croisement base SIG et SPIE)
parents_ipg <- get_parents_ipg()
liste_produits <- base::merge(liste_produits, get_parents_ipg(), by.x='anim', by.y='ANIM', all.x=T, all.y=F)
parents_ipg <- get_parents_ipg(cheptel)
liste_produits <- base::merge(liste_produits, parents_ipg, by.x='anim', by.y='ANIM', all.x=T, all.y=F)
noms_parents <- as.data.frame(noms_parents)
liste_produits$nommere <- noms_parents$V2[match(liste_produits$numeroMipg, noms_parents$V1)]
liste_produits$nompere <- noms_parents$V2[match(liste_produits$pereGenetique, noms_parents$V1)]
@@ -318,6 +318,9 @@ get_note_carriere <- function(v_ref, params_ponderation){
}
get_note_campagne <- function(prod_vaches_corr, params_ponderation){
# On récupère les coefficients de pondération pour les pointages au sevrage
pps <- params_ponderation$pointage$sevrage
# Groupement et synthèse des données des produits par vache / date de naissance / rang de vélage de la mère
# Ca permet de grouper les jumeaux