Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes: #43

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'main' into development
rafalopespx authored Feb 14, 2024
commit ea616caf465de40f266267985b4a1a3c43a7f8d9
25 changes: 14 additions & 11 deletions R/data_w.R
Original file line number Diff line number Diff line change
@@ -10,22 +10,25 @@
#' @param date_onset Column of dates of onset of the events, normally date of onset of first symptoms of cases
#' @param date_report Column of dates of report of the event, normally date of digitation of the notification of cases
#' @param age_col Age column to be where to cut the data into age classes
#' @param K How many weeks to forecast ahead?
#' @param use.epiweek If TRUE, it uses the CDC epiweek definition where the week starts on Sunday, if FALSE it the week ends at the weekday of the last record date.
#' @param K How much weeks to forecast ahead?

#' [Default] K is 0, no forecasting ahead
#'
#' @return Data in weeks format, with the maximum dates for the last week used
#' @export
#'
#' @examples If the last data is on a Sunday, the week starts on the previous Monday.
#' If it ends on Thursday, the week starts on the Friday before
data.w<-function(dataset,
trim.data,
bins_age = c("SI-PNI", "10 years", "5 years", bins_age),
date_onset,
date_report,
age_col,
K=0,
silent=F){
#' @examples If the last data is at a Sunday, so the weel starts at Monday before.
#' If ends at Thursday, so it starts on the Friday before
data.w <- function(dataset,
trim.data,
bins_age = c("SI-PNI", "10 years", "5 years", bins_age),
date_onset,
date_report,
age_col,
use.epiweek = FALSE,
K = 0,
silent = F){
if(!silent){
## Last digitation date considered
if(missing(trim.data)){
7 changes: 4 additions & 3 deletions R/data_w_no_age.R
Original file line number Diff line number Diff line change
@@ -8,14 +8,15 @@
#' @param trim.data How much to trim of the data?
#' @param date_onset Column of dates of onset of the events, normally date of onset of first symptoms of cases
#' @param date_report Column of dates of report of the event, normally date of digitation of the notification of cases
#' @param K How many weeks to forecast ahead?
#' @param use.epiweek If TRUE, it uses the CDC epiweek definition where the week starts on Sunday, if FALSE it the week ends at the weekday of the last record date.
#' @param K How much weeks to forecast ahead?
#' [Default] K is 0, no forecasting ahead
#'
#' @return Data in weeks format, with the maximum dates for the last week used
#' @export
#'
#' @examples If the last data is on a Sunday, so the week starts on the previous Monday.
#' If it ends on Thursday, the week starts on the Friday before
#' @examples If the last data is at a Sunday, so the week starts at Monday before.
#' If ends at Thursday, so it starts on the Friday before
data.w_no_age<-function(dataset,
trim.data,
date_onset,
12 changes: 2 additions & 10 deletions R/nowcasting_inla.R
Original file line number Diff line number Diff line change
@@ -353,16 +353,8 @@ nowcasting_inla <- function(dataset,
## Objects to be returned

if(data.by.week){

if(missing(age_col)){
now_summary[[3-l]]<-data_w |>
dplyr::group_by(date_onset, Delay) |>
dplyr::summarise(observed = dplyr::n())
} else {
now_summary[[3-l]]<-data_w |>
dplyr::group_by(date_onset, Delay, fx_etaria) |>
dplyr::summarise(observed = dplyr::n())
}
now_summary[[3-l]]<- data.inla

names(now_summary)[3-l]<-"data"
if(trajectories){
now_summary[[4-l]]<-sample.now
You are viewing a condensed version of this merge commit. You can view the full changes here.