Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter.mids and apply in mice.mids(., newdata = df) #269

Merged
merged 5 commits into from
Oct 24, 2020

Conversation

prockenschaub
Copy link
Contributor

Scope

This pull request adds a filter.mids function as discussed in #32 and #266 .

Progress

  • Implement filter.mids

  • Create tests for ignore in filter.mids

  • Create documentation for filter.mids

  • Apply filter to mice.mids(., newdata = df)

@prockenschaub
Copy link
Contributor Author

The functionality implemented here is just the basice functionality, allowing to filter the object based on a logical include vector. It should be relatively easy to also allow for arbitrary selections based on the imputations by accepting a closure for include, which is evaluated within filter.mids and passed the mids object .

@stefvanbuuren stefvanbuuren merged commit 437ad0d into amices:add_ignore Oct 24, 2020
@stefvanbuuren
Copy link
Member

Thanks. This is great.

Commit 54efb0c convert filter.mids() into an S3-method for dplyr::filter(), so we can now also use syntax like

imp <- mice(nhanes, m = 2, maxit = 1, print = FALSE)
imp_f2 <- filter(imp, age >= 2 & hyp == 1)
nrow(complete(imp_f2))  # should be 5

Now merged into add_ignore.

@prockenschaub prockenschaub deleted the add_filter branch January 10, 2022 08:20
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.

2 participants