-
Notifications
You must be signed in to change notification settings - Fork 3
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
Bug Fixes #26
Bug Fixes #26
Conversation
{abline(v= dat_outp$V5, lty=2, lwd=1.5, col= "green4") | ||
abline(v= dat_outp$V6, lty=4, lwd=1.5, col= "royalblue") | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move plotting functions outside of main function to make main function more readable
|
||
rFunction <- function(data, threshold = NULL, window = 72, yaxs_limit = 1000) { | ||
original_track_id_column <- mt_track_id_column(data) | ||
track_attribute_data <- mt_track_data(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Save track attribute data for returning object at the end
) | ||
|
||
if (nrow(track_data) > 10 & tint > window) { ## To filter individuals with very few relocations | ||
data_temp <- tryCatch( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing all this in one dplyr function
) | ||
), | ||
error = function(e) { | ||
if (grepl("rollmean", e$message)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Catch error that can happen if window is too small
for (i in 1:length(track_ids)) { | ||
track_id <- track_ids[i] | ||
|
||
animal_id <- track_attribute_data |> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getting animal id
)) | ||
|
||
# convert the data.frame output into move2 object | ||
dat_final <- left_join( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
join track attribute data back with data from function
@@ -0,0 +1,39 @@ | |||
source(here("tests/testthat/helper.R")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some unit tests to make sure function executes
Gone through the changes you have made and most of them make sense to me...I'll do some more through testing probably with some edge cases...Great work @smthfrmn |
This PR does some refactoring and bug fixes, namely:
threshold
is passed by user or uses default@nilanjanchatterjee I included comments throughout the code explaining what I did