Start a conversation

API R package troubleshooting

This article contains solutions to the most common error messages and issues when using the Castor EDC R Package

Keep packages updates

As a general concept it is important to note, that R packages get updates separately. It is thus possible to have out-of-date packages installed that will impact the functioning of other packages. To avoid issues due to this mismatch, keep your packages updated, especially the ones that the Castor EDC package depends on: dplyr, tidyr, purr, glue, jsonlite, and httr.

Can't recycle

recycle() is a function that R applies to match the length of two arguments, usually vectors.  When the sizes are incompatible, the following error will appear:

Error: Can't recycle `..1` (size 971) to match `..2` (size 0).

Note: the numbers will be different depending on the dataset
       To fix this, update the tidyr package.

Non-zero exit status

This message can appear as the result of the installation of a package like Castor EDC.:

Error: Failed to install 'castoRedc' from GitHub:  (converted from warning) installation of package 'later' had non-zero exit status

Receiving this message means that the package was not installed. There can be different reasons why this happens, which means there are also different ways to fix this. The most common causes when installing the castoRedc package is the existence of unresolved dependencies. To resolve this you can use one of the following methods:

  • Force the installation of the dependencies at the same time by adding dependencies=TRUE:
# install.packages("remotes")
remotes::install_github("castoredc/castoRedc", dependencies=TRUE)
  • Install devtools and then use it to install the requested package:
# install.packages("remotes")

Output containing blanks and NAs

Sometimes, the output of a call can return both blanks and NAs. This is not an error, neither is it random. What is the difference between the two values? 

If a field value is equal to NA in R, it means that the field never had a value. In other words, the field never contained any data for this particular record.

If the field value is equal to an empty text (i.e., you don't see a value at all, not even NA), then it is likely that the field contained data, but that this has been cleared again. This field value can be considered to be "", i.e., an empty string.

See this behavior in the following image:

Choose files or drag and drop files
Was this article helpful?
  1. Castor Support Team

  2. Posted
  3. Updated