Repository navigation
BREAKING CHANGES
-
In
demean()anddegroup(), a formula inbywhose terms are separated
only by/, such asby = ~ L3/L2, now means a nested design, like the
stringby = "L3/L2". Before, such a formula gave a cross-classified design
unlessnested = TRUEwas set. Only the right-hand side of a formula in
byis read now. Before, a variable on the left-hand side was also used as
a grouping variable (#722). -
demean()anddegroup()now stop with an error whenbymixes nested and
cross-classified grouping. A formula with both+and/, such as
by = ~ C + A/B, gave a cross-classified design before, or a nested design
withnested = TRUE. A character vector such asby = c("C", "A/B"), with
no column named"A/B", gave an error that a variable was not found. A
string such asby = "C + A/B"gave the same error (#722).
CHANGES
-
New function
collapse_levels()merges sparse levels of factors and character
vectors. Nominal levels merge into one level, and ordered levels merge with a
neighbor. Withpool = TRUE, the items of a scale get the same merges (#48). -
degroup()now also accepts a function incenter, e.g.
center = function(x) mean(x, trim = 0.2)(#21). -
demean()anddegroup()gain agrand_centerargument, to grand-mean
center the group-meaned and de-meaned variables (#637). -
demean()anddegroup()now warn when the data do not seem to matchby.
Withnested = FALSE, the warning comes when each value of oneby
variable occurs with only one value of another, which suggests a nested
design. Withnested = TRUE, it comes when a pair of adjacentby
variables seems to be listed from the lowest to the highest level. Use
verbose = FALSEto turn the checks off (#722). -
center()andstandardize()gain aclusterargument. Ifclusteris
given, the center and scale come from one value per cluster. Cluster-level
variables in unbalanced long-format data are then not weighted by cluster
size.clustercan also be several column names, or a list of cluster id
vectors (#672). -
skewness(),kurtosis(), andsmoothness()now return objects of class
datawizard_skewness,datawizard_kurtosis, anddatawizard_smoothness.
The old class namesparameters_skewness,parameters_kurtosis, and
parameters_smoothnessremain as secondary classes, so code that checks
class(x)[1]for the old names needs to be updated (#248). -
describe_distribution()gains anindicesargument, to select the
optional columns to return, e.g. to leave out skewness and kurtosis.
Argumentsdispersion,iqr,range, andquartilesare deprecated.
Please useindicesinstead (#687). -
adjust()gains..., which passes arguments to the function that fits the
model. Rows that the model drops, for example for a missing value in
weights, areNAin the adjusted variables (#696).
FIXES
-
skewness()andkurtosis()now return the standard error for the chosen
type. Before, theSEcolumn was the type-1 standard error for every
type, including the defaulttype = "2". Bootstrapped standard errors
(iterations) are not changed. -
Fixed an error in
adjust()withmultilevel = TRUEandbayesian = TRUE
whenrstanarmwas not attached (#726). -
Fixed
demean()anddegroup()for nested designs with three or more
grouping variables. The group-meaned variables of the third and later
variables inbywere wrong (#720). -
data_filter()now finds variables of the function that calls it, so
conditions likedata_filter(data, x == values[i])work inside functions
and loops. Internal variables ofdata_filter()no longer hide variables of
the calling code. A condition that gives a warning now returns the filtered
data with that warning (#309, #379). -
standardize()now works with models coerced with
lmerTest::as_lmerModLmerTest(). You can also pass a standardized
lme4::lmer()model toas_lmerModLmerTest()or toupdate()(#716). -
Fixed
standardize()on data frames whencenterorscaleis a single
TRUEorFALSE.scale = FALSEstill divided by the standard deviation,
center = FALSEdid not scale, andcenter = TRUEdid not scale either.
The results now match those for a single variable. -
Fixed
winsorize()withmethod = "percentile"for data with missing
values. Missing values counted toward the number of observations, which gave
wrong results: the lower limit was too high in some cases, and the upper
limit was too high or was not applied. -
winsorize()no longer makes a variable with more than one distinct value
constant. With no missing values, this happened at the defaultthresholdto
a dummy variable whose rarer value made up 20% or less of the values. Such a
variable now comes back unchanged, with a warning that names the column in a
data frame.verbose = FALSEturns the warning off (#736). -
Fixed wrong results of
standardize()on data frames when only one of
centerandscalewas given. Ascalealone was ignored, so
scale = 2gave z-scores. With acenteralone, the variables were not
divided by their standard deviation, socenter = 1only subtracted 1. The
results now match those for a single variable. -
Fixed wrong results of
standardize()andcenter()on data frames when
centerorscaleis a named vector andappendis used. The named values
were ignored, so the appended columns used the mean and standard deviation of
each variable instead.