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

REDCapR: redcap_read function gives error in R version 3.6.1 and not 3.5.3 #272

Closed
sybandrew opened this issue Nov 13, 2019 · 9 comments · Fixed by #277
Closed

REDCapR: redcap_read function gives error in R version 3.6.1 and not 3.5.3 #272

sybandrew opened this issue Nov 13, 2019 · 9 comments · Fixed by #277
Assignees

Comments

@sybandrew
Copy link

Hello,
There is an issue with the redcap_read function in the package REDCapR for people using the new version of R (3.6.1) compared to the older R version (3.5.3).

What I did: I attached two images: REDCapR photo 1 and REDCapR photo 2 of the code I ran in R markdown and the error that I got at the end of the code.

REDCapR photo 1

REDCapR photo 2

What I was expecting: I was expecting the last part of that code in image: REDCapR photo 1 & 2 to import my data from REDCap but it didn't. I looked up the error and troubleshooted several times but nothing worked. Then 2 of my colleagues tried.

  1. The first colleague had a Mac and tried running the same code on the new version of R 3.6.1 and got the same error
  2. The second colleague tried on her lenovo laptop with R version 3.5.3 and was able to run the code with no problem

What actually happened: I got an error using R version 3.6.1 on lenovo laptop which can be seen in REDCapR photo 2.

REDCapR photo 2

I ended up using the function redcap_read_oneshot instead of redcap_read which worked and is shown in image REDCapR photo 3. However, I read that redcap_read is used for larger datasets and if larger datasets need to be imported, I would like to use this function. Please help. Thank you.

REDCapR photo 3

Best regards,
Sybandrew

@wibeasley wibeasley self-assigned this Nov 13, 2019
@wibeasley
Copy link
Member

@sybandrew, thanks for providing so much detail. There's a chance that it's not a difference in R, but a difference in the packages. Will you please update all the packages (update.packages()) and install the newest version of REDCapR on GitHub (remotes::install_github(repo="OuhscBbmc/REDCapR"))? You should restart RStudio first.

If the problem still remains, can you please tell me your version of REDCap, and the results of traceback()?

@sybandrew
Copy link
Author

Hello,
I followed your instructions. See photo REDCapR photo 5

REDCapR photo 5

I still got the error. Please see image REDCapR photo 4.

REDCapR photo 4

The version of REDCapR is ‘REDCapR’ version 0.10.2.9002

Thank you

@wibeasley
Copy link
Member

Cool. A few more questions

  1. What version of REDCap?
  2. Are all the packages updated (with update.packages())?
  3. Did this ever work? If so, when did it stop working?
  4. What institution are you?
  5. What are the results of REDCapR::redcap_metadata_read()?
  6. If the metadata fails, can you send me your data dictionary? (email [email protected])

This might be related to an issue from yesterday (#269)

@sybandrew
Copy link
Author

  1. What version of REDCap?
    The version of REDCap being used is 9.3.3 which was recently updated last month

  2. Are all the packages updated (with update.packages())?
    Yes, all the packages were updated using update.packages(). However, I always check for updates so none appeared. See first image. However, I did it again and ran a traceback, please see second image

REDCapR photo 5

REDCapR photo 7

  1. Did this ever work? If so, when did it stop working?
    Yes, this function did work at one point for users but I am not sure when it stopped working.

  2. What institution are you?
    I am a REDCap administrator at CHOP (Children's Hospital Of Philadelphia)

  3. What are the results of REDCapR::redcap_metadata_read()?
    I still get an error with this as well. See image below

REDCapR photo 6

  1. If the metadata fails, can you send me your data dictionary? (email [email protected])
    I am waiting for permission from a client to send you their data dictionary. Once, I get an answer I will email you.

Thank you.

@wibeasley
Copy link
Member

This wasn't the original source of the problem, but could you

  1. remove the arguments from redcap_metadata_read(), besides the uri and token? The events isn't a parameter of the metadata.
  2. if that works, add the fields parameter back, and see what happens.

@sybandrew
Copy link
Author

Good morning,
I did that and got the same error, see image below. I had previously did this during my trouble shooting with functions redcap_metadata_read and redcap_read to see if the field or eventnames may have been the issue.

REDCapR photo 8

@sybandrew
Copy link
Author

I also ran a traceback(), see image below.

REDCapR photo 9

@sybandrew
Copy link
Author

I sent you an email with the error I found along with some questions. Thanks

@wibeasley
Copy link
Member

@sybandrew and I worked on this and determined that the problematic character in the data dictionary was a curly single quote (as opposed to a straight curly quote). This is very similar to the issue (and solution) raised by @vortexing in #269 two days before this one.

The solution to #269 also fixed this guy. As a precaution, we included a different type of curly/slanty single quote in the test suite, so a regression bug is less likely.

If someone in the future comes across a character that causes problem, please follow my request in
#269 (comment):

If anyone encounters something similar, please consider

  1. creating a new issue that references this one (ie, include the text "Issue redcap_metadata_read, "object 'ds' not found"  #269")
  2. in the issue, attach the your data dictionary, I'll isolate the problematic fields and include them in the live version of problematic-dictionary.csv. If you're uncomfortable sharing your dictionary with the world, either (a) isolate the fields yourself before attaching it, or (b) email it to me.

If we can't find a way for REDCapR to gracefully adapt, we'll at least try to provide a better error message.

Here are some screenshots of how the curly quote looks in REDCap and in the dictionary (viewed as vanilla csv)

image

image

Here is a description that distinguishes the types of quotes.

https://practicaltypography.com/straight-and-curly-quotes.html
image

Note that what is good with humans is trickier for computers.
image

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 a pull request may close this issue.

2 participants