Write columns of the imputed data in the same sequence as the incomplete data (long form) #569
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.
The call
complete(imp, action = "long", include = TRUE)exports the imputed data in long form with(m + 1) * nrecords. The exported data contains two new variables with names:".imp": the imputation sequence number, starting from 0 (for the original data) through1:m".id": therow.namesofimp$dataUntil now, the new variables are written to columns 1 and 2 of the data. The disadvantage is that this changes the column positions as found in the original data
imp$data.This PR writes the two new variables as the last two variables. In this way, the columns of the imputed data will have the same positions as in the original data, which is more user-friendly and easier to work with.
Commit cdb8bcf solves a problem with
complete()that prevented proper transfer of the type of.idvariable (integerorcharacter).Commit ca1e876 changes the column order in
complete()and adapts functions that silently assumed that.impand.idwould be in columns 1 and 2, respectively (e.g. in plots and tests).Note that any existing code that assumes that variables
".imp"and".id"are in columns 1 and 2 will need to be modified. The advice is to modify the code using the variable names".imp"and".id".