Skip to content

Improve verify_data function#138

Draft
pepijnvink wants to merge 3 commits intoamices:mainfrom
pepijnvink:verify_data
Draft

Improve verify_data function#138
pepijnvink wants to merge 3 commits intoamices:mainfrom
pepijnvink:verify_data

Conversation

@pepijnvink
Copy link
Collaborator

@pepijnvink pepijnvink commented Dec 18, 2023

Automatically parse allowed data types rather than manual specification. Additional checks if data are of type matrix are left in. Should resolve #85

Automatically parse allowed data types rather than manual specification. Additional checks if data are of type `matrix` are left in.
R/utils.R Outdated
)
}
if (is.matrix(data)) {
if (dim(data)[1] != dim(data)[2]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is actually a bug in ggmice, because mice does accept non-square predictor matrices

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So line 54 is not correct

@hanneoberman
Copy link
Member

I believe that a better solution would be https://rlang.r-lib.org/reference/arg_match.html

@hanneoberman
Copy link
Member

hanneoberman commented Dec 20, 2023

Maybe using tryCatch could work:

  • check if argument input is of type data.frame,
  • if not, catch error and check if argument input is of type mids,
  • if then not, throw error

https://adv-r.hadley.nz/conditions.html#handling-conditions

Edit preprocessing function for checking data. Add (and implement) preprocessing function for extracting variable names.
@pepijnvink
Copy link
Collaborator Author

Should also resolve #130

@hanneoberman
Copy link
Member

Status check: might not be necessary anymore. Converting to draft.

@hanneoberman hanneoberman marked this pull request as draft October 10, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create general pre-processing function for internal use

2 participants