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

pivot_wider making a list of ages #103

Open
chantelwetzel-noaa opened this issue Mar 23, 2023 · 6 comments
Open

pivot_wider making a list of ages #103

chantelwetzel-noaa opened this issue Mar 23, 2023 · 6 comments
Labels
priority: high The highest priority level in terms of what needs to be done. status: in progress Currently working on this issue topic: code Related to R code within this package type: bug
Milestone

Comments

@chantelwetzel-noaa
Copy link
Contributor

Describe the bug

When trying to pull the biological data for black and canary rockfishes (separately), both pulls encountered the issue of the the age1 (age2,...) being converted into lists by dplyr::pivot_wider. I am not entirely sure what has changed in the pulled data file that is causing this issue. I plan on looking at this more tomorrow but I wanted to post it here just in case.

@brianlangseth-NOAA
Copy link
Contributor

May be that str(age1) indicates something other than a number was entered. Would make sense if new ages were added with an odd field

@shcaba
Copy link

shcaba commented Mar 23, 2023 via email

@kellijohnson-NOAA
Copy link
Contributor

@chantelwetzel-noaa I have had this happen before I just cannot remember why. Hopefully I will remember why this happened. I think it goes back to not having unique identifiers when trying to combine the data. I am pretty sure it is happening here

bds.pacfin <- data %>%
tidyr::pivot_wider(
id_cols = !dplyr::matches("BDS_ID"),
names_from = AGE_SEQUENCE_NUMBER,
values_from = c(
AGE_ID,
AGE_METHOD:AGENCY_AGE_STRUCTURE_CODE
),
names_glue = "{.value}{AGE_SEQUENCE_NUMBER}",
values_fill = NA
)
# Short check b/c pivot_wider can make lists
if (!class(bds.pacfin[["age1"]]) %in% c("integer", "logical")) {
stop(

@chantelwetzel-noaa
Copy link
Contributor Author

@kellijohnson-NOAA Funny cause I remember encountering too but don't recall when or why. That is exactly where it is happening and there is a warning in the stage above about a long list of non-unique ids. Just lovely.

@kellijohnson-NOAA
Copy link
Contributor

Oh the long list on non-unique ids is a problem that is happening in the new data from California. They have duplicate entries and they are trying to figure out why. Brenda knows. That is why I wasn't able to give @iantaylor-NOAA the data that he wanted for the data workshop. I will ping Brenda again and tell her that it is still not fixed.

@chantelwetzel-noaa
Copy link
Contributor Author

It also looks like PacFIN may be down this morning...

@kellijohnson-NOAA kellijohnson-NOAA added type: bug topic: code Related to R code within this package status: in progress Currently working on this issue priority: high The highest priority level in terms of what needs to be done. labels May 8, 2023
@kellijohnson-NOAA kellijohnson-NOAA added this to the year_2023 milestone May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high The highest priority level in terms of what needs to be done. status: in progress Currently working on this issue topic: code Related to R code within this package type: bug
Projects
None yet
Development

No branches or pull requests

4 participants