From 29107dbced92f3eafb69d2bf8a244dc746c4c283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lie=20Siberchicot?= Date: Wed, 20 Mar 2024 15:45:50 +0100 Subject: [PATCH] Correct the call to a variable in the optimisation of the 'pass_infos_discret' function --- R/create_matrix.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/create_matrix.R b/R/create_matrix.R index 0e13923..3f578be 100644 --- a/R/create_matrix.R +++ b/R/create_matrix.R @@ -76,9 +76,9 @@ pass_infos_discret <- function(M, value) { bind_values <- M |> dplyr::select(.data$ancestor, dplyr::all_of(value)) |> stats::na.omit() |> - dplyr::group_by(.data$Status, .data$ancestor) |> + dplyr::group_by(.data[[value]], .data$ancestor) |> dplyr::count() |> - tidyr::pivot_wider(names_from = .data$Status, values_from = .data$n, values_fill = 0) |> + tidyr::pivot_wider(names_from = dplyr::all_of(value), values_from = .data$n, values_fill = 0) |> as.data.frame() |> dplyr::rename("taxid" = "ancestor") |> dplyr::arrange(.data$taxid)