Changelog
wranglr 0.0.3
Breaking changes
create_sumry_tbl()now returnsQ25andQ75columns in place of theIQRcolumn. The quartiles do not assume a symmetric distribution. To get the old value, useQ75 - Q25.create_sumry_tbl()now returns the count of non-missing values inn, and the count of all values in the newtotal_ncolumn.nandNAsnow sum tototal_n. If you usednas the total count, usetotal_n.imputeNAs()is nowimpute_median(). Its behaviour does not change. Replace all calls toimputeNAs()withimpute_median().impute_predictors()is now defunct and gives an error when you call it, it will be fully deprecated/removed in future versions.
New features
-
New
impute_missing()replacesNAvalues in a numeric vector with random draws from a fitted distribution. It estimates the distribution parameters with maximum likelihood.distrselects a Gaussian ("norm", the default), Gamma ("gamma"), or Beta ("beta") distribution, andseedmakes the draws reproducible.x <- rnorm(10, mean = 10, sd = 5) x[c(2, 7)] <- NA_real_ impute_missing(x) # Gaussian impute_missing(abs(x), "gamma") # Gamma
Minor improvements and fixes
create_sumry_tbl()now returnsQ25andQ75columns in place ofIQR, and a newtotal_ncolumn.nnow counts only non-missing values.create_sumry_tbl()now keeps the class and level order of the first grouping column if it is a factor. The “Total” row is the last level. Other column types becomecharacter, so numeric grouping columns, such ascylinmtcars, now work without conversion to a factor.create_sumry_tbl()now returnsNAfor all statistics (excepttotal_n,NAs, andn) when all values ofvarare missing, instead of an error.
wranglr 0.0.2
New
- Updated and improved
create_summ_tbl()- new name!
- now is
create_sumry_tbl()
- now is
- now uses
dplyr::group_by()under the hood for ease of use - new snapshot tests
- new name!
- New methods for
imputeNAs()- character and factor S3 methods
- imputes randomly by sampling according to the distribution of unique values in
xand replaces - now the
.create_strata()function can useimputeNAs() - does so internally using internal methods rather than on-the-fly
- S3 methods for
.get_indices()- now dispatches correctly using S3 methods rather than
switch()and complex logic
- now dispatches correctly using S3 methods rather than
Bugs
- Fixed major bug in
imputeNAs()- data frame method was indexing incorrectly
- removed
seq()call and index only onp - this was a bad one …
Improvements
- Create
vfold_splits()unit tests and minor syntax clean up- added new unit tests (snapshots) for
vfold_splits() - fixed a bug that was caused by using the names of breaks after An unlist
- now uses a tmp
strat_varsvariable
- now uses a tmp
- all snapshots included under the
vfold_splitsvariant
- added new unit tests (snapshots) for
- Simplified
.get_indices.default()- no just returns if unknown class
- no more
NULLfor no stratification - this is now handled upstream, in
.vfold_splits()
- Removed the
idxparam from.get_indices()methods- this was superfluous and a little hacky
- solution isn’t great but considering it is just in the single data frame use case, maybe acceptable
- Cleaned up
create_kfold()- updated unit tests and simplified code
- streamline methods, especially character and factor for
.get_indices() - breaks now cannot be NA
Removed
- no longer imports the purrr package:
- no longer uses
purrr::transpose() - uses base R and
Map()instead to invert lists - now uses
helpr::piter()overpurrr::pmap()
- no longer uses
- removed all mention of term “adat” and nuke S4 methods
- the
'soma_adat'class is also a data frame so this shouldn’t affect it too much to remove the method explicitly. Should cascade into the date frame method - checks in place to ensure attributes are not stripped
- the