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

Fix: only call replace_na(., 0) on numeric columns #195

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion R/workpatterns_area.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ workpatterns_area <- function(data,
ptn_data_norm <-
ptn_data_norm %>%
select(PersonId, group, all_of(input_var)) %>%
mutate_all(~tidyr::replace_na(., 0)) # Replace NAs with 0s
mutate(across(where(is.numeric), ~tidyr::replace_na(., 0))) # Replace NAs with 0s

# Percentage vs Absolutes
if(values == "percent"){
Expand Down
2 changes: 1 addition & 1 deletion R/workpatterns_classify_pav.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ workpatterns_classify_pav <- function(data,
mutate_at(vars(all_of(input_var)), ~./Signals_Total) %>%
#filter(Signals_Total > 0) %>%
select(all_of(input_var)) %>%
mutate_all(~tidyr::replace_na(., 0)) # Replace NAs with 0s
mutate(across(where(is.numeric), ~tidyr::replace_na(., 0))) # Replace NAs with 0s


## Normalised pattern data
Expand Down
2 changes: 1 addition & 1 deletion R/workpatterns_hclust.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ workpatterns_hclust <- function(data,
mutate_at(vars(input_var), ~./Signals_Total) %>%
filter(Signals_Total > 0) %>%
select(PersonId, all_of(input_var)) %>%
mutate_all(~tidyr::replace_na(., 0)) # Replace NAs with 0s
mutate(across(where(is.numeric), ~tidyr::replace_na(., 0))) # Replace NAs with 0s

## Distance matrix
dist_m <-
Expand Down