Skip to content

redcapConnection() and exportRecordsTyped(): Error in rbind(deparse.level, ...): Number of columns in arguments differ #507

@gorgyx

Description

@gorgyx

I cannot read the records of a REDCap project although the connection ist "up".

This is what I did:
library(redcapAPI)
rcon <- redcapConnection(url = api_url, token = api_token)
records <- exportRecordsTyped(rcon, factors = FALSE)

Here the original error message that came up at this point:
Fehler in rbind(deparse.level, ...) :
Anzahl der Spalten der Argumente unterschiedlich

As I tried to track the error, I found:

  1. rcon$fieldnames() does not include the fieldnames of a field with field_type "file" and some calc fields
  2. The result of rcon$fieldnames() is a data.frame with 1 merged column instead of one with 3 columns, as seems to be expected in .exportRecordsTyped_fieldsArray (namespace:redcapAPI), row 13

ProjectFields <- rbind(ProjectFields, MissingFromFields)

where the error occurs.

str(rcon$fieldnames())

'data.frame': 266 obs. of 1 variable:
$ original_field_name.choice_value.export_field_name: chr "record_id;;record_id" "datum_anmeldung2;;datum_anmeldung2" "anrede;;anrede" "name;;name" ...

sessionInfo()

R version 4.5.2 (2025-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default
LAPACK version 3.12.1

locale:
[1] LC_COLLATE=German_Germany.utf8 LC_CTYPE=German_Germany.utf8 LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C LC_TIME=German_Germany.utf8

time zone: Europe/Berlin
tzcode source: internal

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] redcapAPI_2.11.5

loaded via a namespace (and not attached):
[1] backports_1.5.0 lubridate_1.9.5 rappdirs_0.3.4 filelock_1.0.3 sodium_1.4.0 timechange_0.4.0 generics_0.1.4 shelter_0.2.1 getPass_0.2-4
[10] labelVector_0.1.2 compiler_4.5.2 rstudioapi_0.18.0 tools_4.5.2 checkmate_2.3.4 curl_7.0.0 mime_0.13 yaml_2.3.12 jsonlite_2.0.0
[19] chron_2.3-62

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions