Skip to content

Commit

Permalink
fill NAs before any other operation
Browse files Browse the repository at this point in the history
  • Loading branch information
EhrmannS committed Sep 16, 2024
1 parent ddfa630 commit 7fe4f85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Imports:
purrr,
stringr,
lubridate
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Suggests:
knitr,
rmarkdown,
Expand Down
14 changes: 7 additions & 7 deletions R/getIDVars.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ getIDVars <- function(schema = NULL, input = NULL){

}

# copy missing values downwards
if(anyNA(temp[1])){
message("filling NA-values in downwards direction in column '", names(idVars[i]),"'.")
temp <- temp %>%
fill(1, .direction = "down")
}

# split ...
if(!is.null(tempVar$split)){
# need to distinguish between one and several columns
Expand Down Expand Up @@ -123,13 +130,6 @@ getIDVars <- function(schema = NULL, input = NULL){
select(all_of(colFilter))
}

# and copy missing values downwards
if(anyNA(temp[1])){
message("filling NA-values in downwards direction in column '", names(idVars[i]),"'.")
temp <- temp %>%
fill(1, .direction = "down")
}

}

vars <- c(vars, set_names(x = list(temp), nm = names(idVars)[i]))
Expand Down

0 comments on commit 7fe4f85

Please sign in to comment.