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

Error in dplyr::select(): ! Can't select columns that don't exist #49

Open
GeorgianF opened this issue Jul 3, 2024 · 13 comments
Open

Comments

@GeorgianF
Copy link

GeorgianF commented Jul 3, 2024

API endpoint used:
study <- castor_api$getStudyData(study_id)

  • Error displayed in the console:

Error in dplyr::select():
! Can't select columns that don't exist.
Column NA doesn't exist.
Run rlang::last_trace() to see where the error occurred.

  • Run command rlang::last_trace()

<error/vctrs_error_subscript_oob>
Error in dplyr::select():
! Can't select columns that don't exist.
Column NA doesn't exist.

Backtrace:

  1. ├─castor_api$getStudyData(study_id)
  2. │ └─self$getRepeatingDataInstances(study_id = study_id, id_to_field_name = id_to_name)
  3. │ └─self$getRepeatingDataInstancesBulk(...)
  4. │ └─... %>% dplyr::select(!NA)
  5. ├─dplyr::select(., !NA)
  6. └─dplyr:::select.data.frame(., !NA)
    Run rlang::last_trace(drop = FALSE) to see 19 hidden frames.
  • Run command rlang::last_trace(drop = FALSE)

<error/vctrs_error_subscript_oob>
Error in dplyr::select():
! Can't select columns that don't exist.
Column NA doesn't exist.

Backtrace:

  1. ├─castor_api$getStudyData(study_id)
  2. │ └─self$getRepeatingDataInstances(study_id = study_id, id_to_field_name = id_to_name)
  3. │ └─self$getRepeatingDataInstancesBulk(...)
  4. │ └─... %>% dplyr::select(!NA)
  5. ├─dplyr::select(., !NA)
  6. ├─dplyr:::select.data.frame(., !NA)
  7. │ └─tidyselect::eval_select(expr(c(...)), data = .data, error_call = error_call)
  8. │ └─tidyselect:::eval_select_impl(...)
  9. │ ├─tidyselect:::with_subscript_errors(...)
  10. │ │ └─base::withCallingHandlers(...)
  11. │ └─tidyselect:::vars_select_eval(...)
  12. │ └─tidyselect:::walk_data_tree(expr, data_mask, context_mask)
  13. │ └─tidyselect:::eval_c(expr, data_mask, context_mask)
  14. │ └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
  15. │ └─tidyselect:::walk_data_tree(new, data_mask, context_mask)
  16. │ └─tidyselect:::eval_bang(expr, data_mask, context_mask)
  17. │ └─tidyselect:::walk_data_tree(expr[[2]], data_mask, context_mask)
  18. │ └─tidyselect:::as_indices_sel_impl(...)
  19. │ └─tidyselect:::as_indices_impl(...)
  20. │ └─tidyselect:::chr_as_locations(x, vars, call = call, arg = arg)
  21. │ └─vctrs::vec_as_location(...)
  22. └─vctrs (local) ()
  23. └─vctrs:::stop_subscript_oob(...)
  24. └─vctrs:::stop_subscript(...)
    
  25.   └─rlang::abort(...)
    
@GeorgianF
Copy link
Author

GeorgianF commented Jul 24, 2024

Hey all, @martijnkersloot , @reiniervlinschoten, any chance that this error can be looked at?
I've tried today on 3 different studies:

  1. Study ID: 46DE66F8-54BA-4570-A965-27947F39ECF9 error in R Studio
image
  1. Study ID: 667FB6F5-C879-407D-8C76-BDC8E47387F3 error in R Studio
image
  1. Study ID: CB08E54D-3E9B-4748-819B-9D686B15E820 no error in R Studio, however this study contains very few data points.

@reiniervlinschoten
Copy link
Collaborator

Hi Georgian, I am sorry, but I would need to see your data, and that is not possible I think?

Some thoughts:

  1. It seems that in this study the error is in the code below. Maybe you can run the code above that line by line, and then check what data is in survey_instances? It seems as if participant_id does not come through (which is very odd).

https://github.com/castoredc/castoRedc/blob/5b50bc0f036f2674aa3e59a520690a7f2b134ea8/R/CastorData.R#L776C1-L781C13

  1. I don't know where that fails, because select is used everywhere in the package?

@GeorgianF
Copy link
Author

@reiniervlinschoten I can invite you to both of the studies where the error arose.
These are just test studies, which I use to troubleshoot different errors which come in Castor Support, so it should not be a problem.
This situation was brought up by multiple users in real Castor Studies and I was able to replicate it.

I've tried to get the surveys with survey_instances <- castor_api$getSurveyInstances(study_id) but I got:
image

Should I invite you to these 2 studies, where the errors are found, with the email from Erasmus?

@MerelAUMC
Copy link

MerelAUMC commented Jul 31, 2024 via email

@MerelAUMC
Copy link

MerelAUMC commented Aug 6, 2024 via email

@reiniervlinschoten
Copy link
Collaborator

reiniervlinschoten commented Aug 8, 2024 via email

@MerelAUMC
Copy link

MerelAUMC commented Aug 8, 2024 via email

@reiniervlinschoten reiniervlinschoten mentioned this issue Aug 10, 2024
2 tasks
@reiniervlinschoten
Copy link
Collaborator

@GeorgianF, I created a new branch (#54). Unfortunately I need access to the studies to see what happens, and I only had some spare time this weekend. Please add castoredcapi.github{at}gmail.com to the studies and I can hopefully fix it sometime, but I will be leaving for a holiday soon.

@MerelAUMC
Copy link

MerelAUMC commented Aug 11, 2024 via email

@MerelAUMC
Copy link

MerelAUMC commented Aug 14, 2024 via email

@slknijnenburg
Copy link
Contributor

@reiniervlinschoten @MerelAUMC Georgian is on holiday this week. In his absence I just invited @reiniervlinschoten to the following studies that @GeorgianF mentioned in a previous comment:

  • 46DE66F8-54BA-4570-A965-27947F39ECF9 (G Furtuna Castor Connect Enabled)
  • 667FB6F5-C879-407D-8C76-BDC8E47387F3 (G Furtuna Live Randomization and Televisit Study)

@MerelAUMC judging by the study names and user lists I doubt these are your studies, but I hope that @reiniervlinschoten can get further based on these two already.

@MerelAUMC
Copy link

MerelAUMC commented Aug 14, 2024 via email

@reiniervlinschoten
Copy link
Collaborator

@MerelAUMC, I understand you need the wrapper to continue your work, but unfortunately I will not be able to fix it before I go on a holiday. Moreover, I worked on this project as a freelancer (not affiliated with Castor), and did this is my spare time besides my regular job. As such, I already communicated to @martijnkersloot that I won´t be able to work on it any further after my holiday. If I have some spare time after my holiday, there might be a small chance that I can pick it up, but this is unlikely. I know @martijnkersloot was looking into it, hopefully he has a solution.

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

4 participants