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

Fix for #87 — force update_datetime to be a datetime #88

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Aariq
Copy link
Collaborator

@Aariq Aariq commented Jan 28, 2025

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.

@Aariq Aariq linked an issue Jan 28, 2025 that may be closed by this pull request
@Aariq Aariq requested a review from jeffswitzer January 28, 2025 23:53
Comment on lines +734 to +741
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))
) %>%
Copy link
Collaborator Author

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")),
Copy link
Collaborator Author

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)
Copy link
Collaborator Author

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?

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

Successfully merging this pull request may close these issues.

Inconsistent column types prevent bind_rows() in npn_get_data_by_year()
1 participant