Skip to content

Commit 49c1da0

Browse files
committed
comment weekday and rename changes
1 parent b6ef12a commit 49c1da0

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

app/R/data_manipulation.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ filterOverAllLocations <- function(filteredScoreDf, scoreType, hasAsOfData = FAL
5757
# May change in the future
5858
filterHospitalizationsAheads <- function(scoreDf) {
5959
days_list <- c("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
60+
# Make sure to use `data.table`'s `wday`; `lubridate` has a function of the same name.
6061
scoreDf["weekday"] <- days_list[data.table::wday(as.Date(scoreDf$target_end_date, "%Y-%m-%d"))]
6162
scoreDf <- filter(scoreDf, weekday == HOSPITALIZATIONS_TARGET_DAY)
6263
scoreDf$ahead_group <- case_when(

app/server.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ server <- function(input, output, session) {
202202
input$asOf != "" &&
203203
nrow(PREV_AS_OF_DATA()) != 0 &&
204204
input$asOf < CURRENT_WEEK_END_DATE()) {
205+
# Equivalent to but faster than the `dplyr`:
206+
# asOfData <- PREV_AS_OF_DATA() %>%
207+
# rename(target_end_date = time_value, as_of_actual = value) %>%
208+
# select(target_end_date, geo_value, as_of_actual)
205209
asOfData <- PREV_AS_OF_DATA()
206210
asOfData$target_end_date <- asOfData$time_value
207211
asOfData$as_of_actual <- asOfData$value

0 commit comments

Comments
 (0)