This function allows removing NA's from long format data into wide (or long) format data, even suporting repeated measures designs (i.e., with more than one subject per factor level).
Usage
clean_data(
data,
x,
y,
rowid = NULL,
paired = FALSE,
wide = FALSE,
character.only = FALSE,
...
)
Arguments
- data
Data from which
x
andy
(and possiblyrowid
if provided) will be searched.- x
Name for the grouping factor. Must be present in data
- y
Name for the response variable. Must be present in data.
- rowid
Name for the subject-id column. If null, then is assumed that data is sorted for paired designs, creating one. So if your data is not sorted and you leave this argument unspecified, the results can be inaccurate when there are more than two levels in x and there are NAs present. Ignored if
paired
isFALSE
.- paired
Logical that decides whether the experimental design is repeated measures/within-subjects or between-subjects. The default is
FALSE.
- wide
Logical to whether return a data.frame in wide format (
TRUE
, i.e. one columns per group/time) or in long format (FALSE
).- character.only
Logical. checks whether to use the unevaluated expression or its content (when TRUE), asumming is a character vector. Defaults to
FALSE
.- ...
Currently ignored.