-
Notifications
You must be signed in to change notification settings - Fork 9
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 for #87 — force update_datetime
to be a datetime
#88
base: master
Are you sure you want to change the base?
Conversation
…or easier debugging in the future
…ecause columns aren't always there.
dplyr::mutate( | ||
dplyr::across(dplyr::where(is.numeric), | ||
function(x) ifelse(x == -9999, NA_real_, x)) | ||
) %>% | ||
dplyr::mutate( | ||
dplyr::across(dplyr::where(is.character), | ||
function(x) ifelse(x == "-9999", NA_character_, x)) | ||
) %>% |
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.
The change from \(x)
to function(x)
is because the shorthand \(x)
is only available in more recent versions of R, but defines an anonymous function identically to function(x)
#return these columns! | ||
dplyr::mutate( | ||
dplyr::across(dplyr::any_of("update_datetime"), | ||
function(x) as.POSIXct(x, tz = "UTC")), |
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.
Not sure what the timezone should be here or if it matters. Could also just make this column character and leave it up to the user to figure out the timezone if they care.
dplyr::mutate( | ||
dplyr::across(dplyr::any_of("update_datetime"), | ||
function(x) as.POSIXct(x, tz = "UTC")), | ||
dplyr::across(dplyr::any_of("intensity_value"), as.character) |
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.
I've found that this column is sometimes numbers, but also sometimes things like "3 to 10". Do you happen to know if abundance_value
is the same?
Fixes #87. Unfortunately more of these could pop up in the future. If they do, I'll try to come up with a more generic fix. Didn't update NEWS because I'm pretty sure this bug was introduced in this version.