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

TSLA function not working #9

Open
amyerspigg opened this issue Sep 23, 2024 · 2 comments
Open

TSLA function not working #9

amyerspigg opened this issue Sep 23, 2024 · 2 comments

Comments

@amyerspigg
Copy link
Collaborator

sum_fticrms <- calc_dist_metrics(pw_ft, flood_event_datetime,

error:

Error in mutate():
ℹ In argument: max_effect_Mid = case_when(...).
Caused by error in case_when():
! Failed to evaluate the left-hand side of formula 1.
Caused by error:
! object 'avg_Mid' not found
Backtrace:

  1. global calc_dist_metrics(pw_ft, flood_event_datetime, c("relabund"))
  2. dplyr::case_when(...)
  3. dplyr:::case_formula_evaluate(...)
  4. rlang::eval_tidy(pair$lhs, env = default_env)
    Error in mutate(., max_effect_Mid = case_when(avg_Mid > avg_Pre ~ max_Mid, :

Caused by error in case_when():
! Failed to evaluate the left-hand side of formula 1.
Caused by error:
! object 'avg_Mid' not found

I checked and there should be data for the mid-point (at least one timepoint) so not sure what's going on

@amyerspigg
Copy link
Collaborator Author

@stephpenn1

@stephpenn1
Copy link
Member

This error is happening because your data frame pw_ft doesn't have any during-event ("Mid") data points. So it cannot execute the line

mutate(max_effect_Mid = case_when(
      avg_Mid > avg_Pre ~ max_Mid,
      avg_Mid < avg_Pre ~ min_Mid,
      avg_Mid == avg_Pre ~ avg_Mid
    )) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants