nutterb / redcapAPI-Defunct

R interface to REDCap (http://www.project-redcap.org/)
42 stars 0 forks source link

Subscript out of bounds when calling exportRecords #133

Closed maxramirez84 closed 4 years ago

maxramirez84 commented 5 years ago

I'm getting the following error when calling exportRecords(rcon, factors = F):

Warning: Error in [: subscript out of bounds
  52: makeRedcapFactor
  51: fieldToVar
  50: exportRecords.redcapApiConnection
  48: readData [XXX]
  47: server [XXX]
Error in coding[, 2] : subscript out of bounds

Concretely, when calling to makeRedcapFactor with a dropdown column without choices, i.e. in meta_data the column select_choices_or_calculations = NA:

Browse[5]> meta_data$select_choices_or_calculations[meta_data$field_name == field_base]
[1] NA

packageVersion("redcapAPI") = 2.2 and REDCap Version 9.0.0

nbarrowman commented 5 years ago

@maxramirez84 thanks for your note above. I encountered the same problem. One of the variables in the database I'm using is a radio button, but it has no choices. Although this appears to be a mistake in the design, it would be good if exportRecords was able to handle it without an error.

The redcapAPI package is extremely useful. My thanks to @nutterb and @jeffreyhorner.

nutterb commented 4 years ago

This is being handled with a warning message in redcapAPI version 2.3