Skip to content

Commit

Permalink
calculate_hms fix
Browse files Browse the repository at this point in the history
- skip_merge part will result in dimension mismatch error when `from` is character(n)
  • Loading branch information
sigmafelix committed Nov 12, 2024
1 parent 0dcba3c commit b961ac3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion R/calculate_covariates.R
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,14 @@ calculate_hms <- function(
paste0("medium_", radius),
paste0("heavy_", radius)
)
skip_merge <- merge(locs, skip_df, by = "time")
# fixed: locs is replicated per the length of from
skip_merge <-
Reduce(rbind,
Map(function(x) {
cbind(locs, skip_df[rep(x, nrow(locs)), ])
}, seq_len(nrow(skip_df)))
)

skip_return <- calc_return_locs(
skip_merge,
POSIXt = TRUE,

Check warning on line 1534 in R/calculate_covariates.R

View workflow job for this annotation

GitHub Actions / lint

file=R/calculate_covariates.R,line=1534,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
Expand Down

0 comments on commit b961ac3

Please sign in to comment.