Skip to content

Commit

Permalink
using as.numeric to avoid integer overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
catalamarti committed Feb 7, 2025
1 parent cd8002e commit a83f3eb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions R/summariseInObservation.R
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,11 @@ countRecords <- function(observationPeriod, cdm, start_date_name, end_date_name,
}

x <- personDays |>
dplyr::mutate(estimate_value = as.integer(.data$estimate_value)) |>
rbind(records) |>
dplyr::mutate(estimate_value = as.numeric(.data$estimate_value)) |>
rbind(
records |>
dplyr::mutate(estimate_value = as.numeric(.data$estimate_value))
) |>
omopgenerics::uniteAdditional(additional_column)|>
dplyr::arrange(dplyr::across(dplyr::any_of("additional_level")))

Expand All @@ -250,7 +253,7 @@ createSummarisedResultObservationPeriod <- function(result, observationPeriod, n
dplyr::mutate("interval" = .env$original_interval))
}else{
result <- result |>
dplyr::mutate("estimate_value" = as.character(.data$estimate_value)) |>
dplyr::mutate("estimate_value" = sprintf('%.0f', .data$estimate_value)) |>
omopgenerics::uniteStrata(cols = c("sex", "age_group")) |>
dplyr::mutate(
"result_id" = as.integer(1),
Expand Down

0 comments on commit a83f3eb

Please sign in to comment.