Update handling of 'to_values' in as.data.frame.px function #19
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.
Created a new PR for making things simpler,
This pull request includes updates to the as.data.frame.px function to improve its robustness and ability to handle a wider range of inputs.
Changes made:
Updated the handling of 'to_values' in the mapvalues function. Now, 'to_values' is created by splitting the string x[[paste0('VALUES', use.language)]][[code_id]] at every occurrence of ", " and ",". This change was made to handle cases where x[[paste0('VALUES', use.language)]][[code_id]] is a single string that needs to be split into a vector of values.
Added a check to ensure that the 'from_values' and 'to_values' vectors are of the same length before they are used in the mapvalues function. If they are not of the same length, the function stops with an error message. This check was added to prevent errors in the mapvalues function.
These changes make the function more robust and capable of handling a wider range of inputs. Please review the changes and merge if everything looks good.
Also added chnages to the doc.