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

vo2_max() and workload column option #6

Closed
Scott-S-Hannah opened this issue Feb 11, 2021 · 6 comments
Closed

vo2_max() and workload column option #6

Scott-S-Hannah opened this issue Feb 11, 2021 · 6 comments

Comments

@Scott-S-Hannah
Copy link

Hi Felipe,

It's me again... haha.

I was just trialing the new vo2_max() function and was wondering whether you would consider adding an option to use a pre-defined workload column? The work_rate_magic option is fantastic but I already have workrate column produced by the gas analyser.

p.s. your GitHub links on your packagedown site are leading to a 404 page. I think there's an M missing from your GitHub account name 🤦‍♂️

Thanks,
Scott

@fmmattioni
Copy link
Owner

Hey Scott!

Thanks a lot for trying it out! Have you tried setting the work_rate_column argument in the read_data() function? Then you can set work_rate_magic to FALSE and that should do the trick. Let me know if it doesn't work.

I am going to update pkgdown, I hadn't noticed that before! Thank you!

@Scott-S-Hannah
Copy link
Author

Scott-S-Hannah commented Feb 12, 2021

Hey Felipe,

Thanks for the quick reply. Unfortunately, setting the work_rate_column in the read_data() function doesn't seem to change how the vo2_max() call works.

I suppose if the read_data() function renamed my Power column when importing to "work_rate", then the vo2_max() function would produce peak power estimate. Another option might be to let users define their work_rate column like you have done with heart rate and rer etc.

perform_max <- function(.data,
                        vo2_column = "VO2",
                        vo2_relative_column = NULL,
                        heart_rate_column = NULL,
                        rer_column = NULL,
                        work_rate_column = NULL,
                        average_method = c("bin", "rolling"),
                        average_length = 30,
                        plot = TRUE,
                        verbose = TRUE) {

  if (!is.null(work_rate_column))
    if (! work_rate_column %in% colnames(.data))
      stop(glue::glue("It looks like the column {work_rate_column} does not exist."),
           call. = FALSE)
  
  out <- dplyr::tibble(POpeak = ifelse(
    is.null(work_rate_column),
    as.integer(max(data_normalized[["work_rate"]])),
    as.interger(max(data_normalized[[work_rate_column]]))
  ))
  
}

Might this work?

Thanks again, Felipe. You'll be pleased to know whippr is getting some good use in my thesis 😁.

@fmmattioni
Copy link
Owner

Oh, I see what the problem is.. I initially had an argument to specify the work rate column in perfom_max(), but ended up removing it to force it to be defined in read_data(). What I forgot to do is to rename the column you pass into read_data() as work_rate. I will push a fix.

It is great to hear that you are using it in your thesis!! If you have any suggestions, feel free to open a discussion in the Discussion tab! I am always looking for ways to improve the package.

@fmmattioni
Copy link
Owner

Hey Scott, I have just created a PR: #7

Could you give it a try?

You can install it with: remotes::install_github("fmmattioni/whippr#7")

@Scott-S-Hannah
Copy link
Author

Works a treat, Felipe. Thanks 🙌

fmmattioni added a commit that referenced this issue Feb 12, 2021
@fmmattioni
Copy link
Owner

Thanks a lot for reporting it, Scott!

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