View source: R/complete-subjects.R
| complete_subjects | R Documentation |
Prepares long/tidy repeated measures data for analysis by keeping only the
subjects observed in every level of x. This is the listwise deletion step
that long_to_wide_converter() applies when paired = TRUE, and thus the
data that two_sample_test(), oneway_anova(), and
pairwise_comparisons() analyze for within-subjects designs.
The following steps are carried out:
Rows with a missing x or subject.id are dropped, since they cannot be
paired.
An error is thrown if any subject has more than one row in a level of x.
Subjects with a missing y value, or without a row, in any level of x
are removed entirely.
complete_subjects(data, x, y, subject.id = NULL)
data |
A data frame (or a tibble) from which variables specified are to
be taken. Other data types (e.g., matrix, table, array, etc.) will not
be accepted. Additionally, grouped data frames from |
x |
The grouping (or independent) variable from |
y |
The response (or outcome or dependent) variable from |
subject.id |
Relevant in case of a repeated measures or within-subjects
design (i.e., |
A tibble in long format with columns .rowid (the subject
identifier, or an internal row identifier when subject.id is NULL),
x (as a factor with unused levels dropped), and y, sorted by .rowid.
Patil, I., (2021). statsExpressions: R Package for Tidy Dataframes and Expressions with Statistical Details. Journal of Open Source Software, 6(61), 3236, https://doi.org/10.21105/joss.03236
library(statsExpressions)
# subjects with a missing rating in any condition are removed
complete_subjects(bugs_long, condition, desire, subject.id = subject)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.