Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It turns out that there is a problem when the name of a lookuptable (secuTrial) is equal to the name of the variable its being used in. If this is the case then the meta variables are not factorized properly.
It triggers this warning:
warning(paste("Unexpected: Not all levels converted for", name, "in form", form))
The fix is removing the
nrow(lookup) == 0
condition. I spent quite some time investigating why I may have put it there in the first place, and as of now I think there is no need. Next to the tests in the package which all still pass without any changes I also made several local checks with private datasets (7 different secuTrial exports including lookuptable data structures). I loaded them before removing the condition and after removing the condition and checked the outputs withall.equal()
. For all exports except the one that triggered the issue in the first placeall.equal()
returnedTRUE
.In summary I think this condition can be safely removed because it serves no purpose and creates problems in specific scenarios.